slice_dst

Struct SliceWithHeader

Source
#[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>

Source

pub fn new<A, I>(header: Header, items: I) -> A
where A: AllocSliceDst<Self>, I: IntoIterator<Item = Item>, I::IntoIter: ExactSizeIterator,

Create a new slice/header DST in a AllocSliceDst container.

§Panics

Panics if the items iterator incorrectly reports its length.

Source

pub fn from_slice<A>(header: Header, s: &[Item]) -> A
where 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>>
where Header: Clone, Item: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Header: Debug, Item: Debug> Debug for SliceWithHeader<Header, Item>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Header, Item> Erasable for SliceWithHeader<Header, Item>

Source§

const ACK_1_1_0: bool = true

Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
Source§

unsafe fn unerase(this: ErasedPtr) -> NonNull<Self>

Unerase this erased pointer. Read more
Source§

fn erase(this: NonNull<Self>) -> NonNull<Erased>

Turn this erasable pointer into an erased pointer. Read more
Source§

impl<Header: Hash, Item: Hash> Hash for SliceWithHeader<Header, Item>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
Source§

impl<Header: PartialEq, Item: PartialEq> PartialEq for SliceWithHeader<Header, Item>

Source§

fn eq(&self, other: &SliceWithHeader<Header, Item>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Header, Item> SliceDst for SliceWithHeader<Header, Item>

Source§

fn layout_for(len: usize) -> Layout

Get the layout of the slice-containing type with the given slice length.
Source§

fn retype(ptr: NonNull<[()]>) -> NonNull<Self>

Add the type onto an untyped pointer. Read more
Source§

impl<Header: Eq, Item: Eq> Eq for SliceWithHeader<Header, Item>

Source§

impl<Header, Item> StructuralPartialEq for SliceWithHeader<Header, Item>

Auto Trait Implementations§

§

impl<Header, Item> Freeze for SliceWithHeader<Header, Item>
where Header: Freeze, Item: Freeze,

§

impl<Header, Item> RefUnwindSafe for SliceWithHeader<Header, Item>
where Header: RefUnwindSafe, Item: RefUnwindSafe,

§

impl<Header, Item> Send for SliceWithHeader<Header, Item>
where Header: Send, Item: Send,

§

impl<Header, Item> !Sized for SliceWithHeader<Header, Item>

§

impl<Header, Item> Sync for SliceWithHeader<Header, Item>
where Header: Sync, Item: Sync,

§

impl<Header, Item> Unpin for SliceWithHeader<Header, Item>
where Header: Unpin, Item: Unpin,

§

impl<Header, Item> UnwindSafe for SliceWithHeader<Header, Item>
where Header: UnwindSafe, Item: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more