pub struct Slice<I, R: ?Sized = [u8]> { /* private fields */ }Expand description
A borrowed, dynamically sized key that satisfies an Invariant.
Implementations§
Source§impl<I, R: ?Sized> Slice<I, R>
impl<I, R: ?Sized> Slice<I, R>
Sourcepub const unsafe fn new_unchecked(key: &R) -> &Self
pub const unsafe fn new_unchecked(key: &R) -> &Self
§Safety
Caller must ensure key upholds invariants, i.e., I::validate(key) would return Ok.
Trait Implementations§
impl<I: Eq, R: Eq + ?Sized> Eq for Slice<I, R>
Source§impl<'a, I, R> Key for &'a Slice<I, R>
impl<'a, I, R> Key for &'a Slice<I, R>
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> = &'a Slice<I, R>
where
Self: 'k
type Insert<'k> = &'a Slice<I, R> where Self: 'k
Keys can either have edges that store inline bytes (e.g., u64,
BoxedSlice),
or pointers (i.e., Slice). Read moreSource§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<I>
type Write = Writer<I>
Constructs a key from an initial reader prefix and sequence of bytes and edges.
Source§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 Slice<I, R>
impl<I: Ord, R: Ord + ?Sized> Ord for Slice<I, R>
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 Slice<I, R>
impl<I: PartialOrd, R: PartialOrd + ?Sized> PartialOrd for Slice<I, R>
impl<I: PartialEq, R: PartialEq + ?Sized> StructuralPartialEq for Slice<I, R>
Source§impl<I, R> ToOwned for Slice<I, R>where
R: ?Sized + Raw,
impl<I, R> ToOwned for Slice<I, R>where
R: ?Sized + Raw,
Source§type Owned = BoxedSlice<I, R>
type Owned = BoxedSlice<I, R>
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
Auto Trait Implementations§
impl<I, R> Freeze for Slice<I, R>
impl<I, R> RefUnwindSafe for Slice<I, R>
impl<I, R> Send for Slice<I, R>
impl<I, R> Sync for Slice<I, R>
impl<I, R> Unpin for Slice<I, R>
impl<I, R> UnsafeUnpin for Slice<I, R>where
R: UnsafeUnpin + ?Sized,
impl<I, R> UnwindSafe for Slice<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