Trait zerovec::map::ZeroMapKV [−][src]
pub trait ZeroMapKV<'a> {
type Container: ZeroVecLike<'a, Self, NeedleType = Self::NeedleType, GetType = Self::GetType, OwnedType = Self::OwnedType> + Sized;
type NeedleType: ?Sized;
type GetType: ?Sized;
type SerializeType: ?Sized;
type OwnedType;
fn as_needle(&self) -> &Self::NeedleType;
fn cmp_get(&self, g: &Self::GetType) -> Ordering;
fn with_ser<R>(
g: &Self::GetType,
f: impl FnOnce(&Self::SerializeType) -> R
) -> R;
fn owned_as_self(o: &Self::OwnedType) -> &Self;
}
Expand description
Associated Types
type Container: ZeroVecLike<'a, Self, NeedleType = Self::NeedleType, GetType = Self::GetType, OwnedType = Self::OwnedType> + Sized
type Container: ZeroVecLike<'a, Self, NeedleType = Self::NeedleType, GetType = Self::GetType, OwnedType = Self::OwnedType> + Sized
The container that can be used with this type: ZeroVec
or VarZeroVec
.
type NeedleType: ?Sized
type NeedleType: ?Sized
The type to use with Container::binary_search()
This type will be predetermined by the choice of Self::Container
The type produced by Container::get()
This type will be predetermined by the choice of Self::Container
type SerializeType: ?Sized
type SerializeType: ?Sized
The type to use whilst serializing. This may not necessarily be Self
, however it
must serialize to the exact same thing as Self
Required methods
fn as_needle(&self) -> &Self::NeedleType
fn as_needle(&self) -> &Self::NeedleType
Convert to a needle for searching
Compare this type with a Self::GetType
. This must produce the same result as
if g
were converted to Self
fn with_ser<R>(
g: &Self::GetType,
f: impl FnOnce(&Self::SerializeType) -> R
) -> R
fn with_ser<R>(
g: &Self::GetType,
f: impl FnOnce(&Self::SerializeType) -> R
) -> R
Obtain a version of this type suitable for serialization
This uses a callback because it’s not possible to return owned-or-borrowed types without GATs
fn owned_as_self(o: &Self::OwnedType) -> &Self
fn owned_as_self(o: &Self::OwnedType) -> &Self
Convert an owned value to a borrowed Self