#[repr(C)]pub struct SliceWithHeader<Header, Item> {
pub header: Header,
pub slice: [Item],
/* private fields */
}
Expand description
A custom slice-based DST.
The length is stored as a usize
at offset 0.
This must be the length of the trailing slice of the DST.
Fields§
§header: Header
The included header. Does not dictate the slice length.
slice: [Item]
The included slice.
Implementations§
Source§impl<Header, Item> SliceWithHeader<Header, Item>
impl<Header, Item> SliceWithHeader<Header, Item>
Sourcepub fn new<A, I>(header: Header, items: I) -> A
pub fn new<A, I>(header: Header, items: I) -> A
Create a new slice/header DST in a AllocSliceDst
container.
§Panics
Panics if the items iterator incorrectly reports its length.
Sourcepub fn from_slice<A>(header: Header, s: &[Item]) -> Awhere
A: AllocSliceDst<Self>,
Item: Copy,
pub fn from_slice<A>(header: Header, s: &[Item]) -> Awhere
A: AllocSliceDst<Self>,
Item: Copy,
Create a new slice/header DST from a slice, in a AllocSliceDst
container.
Trait Implementations§
Source§impl<Header, Item> Clone for Box<SliceWithHeader<Header, Item>>
impl<Header, Item> Clone for Box<SliceWithHeader<Header, Item>>
Source§impl<Header, Item> Erasable for SliceWithHeader<Header, Item>
impl<Header, Item> Erasable for SliceWithHeader<Header, Item>
Source§impl<Header: PartialEq, Item: PartialEq> PartialEq for SliceWithHeader<Header, Item>
impl<Header: PartialEq, Item: PartialEq> PartialEq for SliceWithHeader<Header, Item>
Source§fn eq(&self, other: &SliceWithHeader<Header, Item>) -> bool
fn eq(&self, other: &SliceWithHeader<Header, Item>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.