pub struct BoxedSlice<I, R: ?Sized = [u8]> { /* private fields */ }Expand description
An owned, dynamically sized key that satisfies an Invariant.
Implementations§
Source§impl<I, R> BoxedSlice<I, R>
impl<I, R> BoxedSlice<I, R>
Source§impl<I, R: ?Sized> BoxedSlice<I, R>
impl<I, R: ?Sized> BoxedSlice<I, R>
Sourcepub const unsafe fn new_unchecked(key: Box<R>) -> Self
pub const unsafe fn new_unchecked(key: Box<R>) -> Self
Construct a boxed slice without validating.
§SAFETY
Caller must guarantee that raw satisfies the invariant, i.e.,
I::validate(key) would return Ok(()).
Sourcepub const fn as_slice(&self) -> &Slice<I, R>
pub const fn as_slice(&self) -> &Slice<I, R>
Get a borrowed Slice that preserves the invariant.
Sourcepub fn into_boxed_slice(self) -> Box<R>
pub fn into_boxed_slice(self) -> Box<R>
Get an owned boxed slice.
Trait Implementations§
Source§impl<I, R: ?Sized> Clone for BoxedSlice<I, R>
impl<I, R: ?Sized> Clone for BoxedSlice<I, R>
Source§impl<I, R: ?Sized> Default for BoxedSlice<I, R>
impl<I, R: ?Sized> Default for BoxedSlice<I, R>
Source§impl<I, R: ?Sized> Deref for BoxedSlice<I, R>
impl<I, R: ?Sized> Deref for BoxedSlice<I, R>
impl<I: Eq, R: Eq + ?Sized> Eq for BoxedSlice<I, R>
Source§impl From<CString> for BoxedSlice<Terminated<0>, [u8]>
impl From<CString> for BoxedSlice<Terminated<0>, [u8]>
Source§impl<I, R> Key for BoxedSlice<I, R>
impl<I, R> Key for BoxedSlice<I, R>
Source§type Read<'k> = Reader<'k, <I as Invariant>::Terminate>
type Read<'k> = Reader<'k, <I as Invariant>::Terminate>
Tracks key length and allows extracting edges and slicing key bytes.
Source§type Write = Writer
type Write = Writer
Constructs a key from an initial reader prefix and sequence of bytes and edges.
Source§type Borrowed = Slice<I, R>
type Borrowed = Slice<I, R>
A non-allocated byte sequence that a key can be cheaply borrowed as.
Source§type Insert<'k> = &'k Slice<I, R>
type Insert<'k> = &'k Slice<I, R>
Keys can either have edges that store inline bytes (e.g., u64,
BoxedSlice),
or pointers (i.e., Slice). Read moreSource§fn insert_as_read<'k>(insert: Self::Insert<'k>) -> Self::Read<'k>where
Self: 'k,
fn insert_as_read<'k>(insert: Self::Insert<'k>) -> Self::Read<'k>where
Self: 'k,
Convert the insert type to a reader with appropriate lifetime.
Source§fn insert_to_key<'k>(insert: Self::Insert<'k>) -> Selfwhere
Self: 'k,
fn insert_to_key<'k>(insert: Self::Insert<'k>) -> Selfwhere
Self: 'k,
Convert the insert type to the key type.
Source§impl<I: Ord, R: Ord + ?Sized> Ord for BoxedSlice<I, R>
impl<I: Ord, R: Ord + ?Sized> Ord for BoxedSlice<I, R>
Source§fn cmp(&self, other: &BoxedSlice<I, R>) -> Ordering
fn cmp(&self, other: &BoxedSlice<I, R>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<I: PartialOrd, R: PartialOrd + ?Sized> PartialOrd for BoxedSlice<I, R>
impl<I: PartialOrd, R: PartialOrd + ?Sized> PartialOrd for BoxedSlice<I, R>
impl<I: PartialEq, R: PartialEq + ?Sized> StructuralPartialEq for BoxedSlice<I, R>
Auto Trait Implementations§
impl<I, R> Freeze for BoxedSlice<I, R>where
R: ?Sized,
impl<I, R> RefUnwindSafe for BoxedSlice<I, R>
impl<I, R> Send for BoxedSlice<I, R>
impl<I, R> Sync for BoxedSlice<I, R>
impl<I, R> Unpin for BoxedSlice<I, R>
impl<I, R> UnsafeUnpin for BoxedSlice<I, R>where
R: ?Sized,
impl<I, R> UnwindSafe for BoxedSlice<I, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more