slice_dst

Struct StrWithHeader

Source
#[repr(C)]
pub struct StrWithHeader<Header> { pub header: Header, pub str: str, /* private fields */ }
Expand description

A custom str-based DST.

The length is stored as a usize at offset 0. This must be the length of the trailing slice.

Fields§

§header: Header

The included header. Does not dictate the slice length.

§str: str

The included str.

Implementations§

Source§

impl<Header> StrWithHeader<Header>

Source

pub fn new<A>(header: Header, s: &str) -> A
where A: AllocSliceDst<Self>,

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

Trait Implementations§

Source§

impl<Header> Clone for Box<StrWithHeader<Header>>
where Header: 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> Debug for StrWithHeader<Header>

Source§

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

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

impl<Header> Erasable for StrWithHeader<Header>

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> Hash for StrWithHeader<Header>

Source§

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

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

impl<Header: PartialEq> PartialEq for StrWithHeader<Header>

Source§

fn eq(&self, other: &StrWithHeader<Header>) -> 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> SliceDst for StrWithHeader<Header>

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> Eq for StrWithHeader<Header>

Source§

impl<Header> StructuralPartialEq for StrWithHeader<Header>

Auto Trait Implementations§

§

impl<Header> Freeze for StrWithHeader<Header>
where Header: Freeze,

§

impl<Header> RefUnwindSafe for StrWithHeader<Header>
where Header: RefUnwindSafe,

§

impl<Header> Send for StrWithHeader<Header>
where Header: Send,

§

impl<Header> !Sized for StrWithHeader<Header>

§

impl<Header> Sync for StrWithHeader<Header>
where Header: Sync,

§

impl<Header> Unpin for StrWithHeader<Header>
where Header: Unpin,

§

impl<Header> UnwindSafe for StrWithHeader<Header>
where Header: 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