pub struct IndexKey {
pub index_id: IndexId,
pub hashed_values: Vec<[u8; 16]>,
}Expand description
IndexKey
Fields§
§index_id: IndexId§hashed_values: Vec<[u8; 16]>Implementations§
Source§impl IndexKey
impl IndexKey
pub const STORABLE_MAX_SIZE: u32 = 180u32
Sourcepub fn new<E: EntityKind>(entity: &E, index: &IndexSpec) -> Option<Self>
pub fn new<E: EntityKind>(entity: &E, index: &IndexSpec) -> Option<Self>
Build an index key from an entity and spec, returning None if a component is missing/non-indexable.
Sourcepub fn max_storable() -> Self
pub fn max_storable() -> Self
Largest representable index key (for sizing).
Sourcepub fn bounds_for_prefix(
index_id: IndexId,
prefix: Vec<[u8; 16]>,
) -> (Self, Self)
pub fn bounds_for_prefix( index_id: IndexId, prefix: Vec<[u8; 16]>, ) -> (Self, Self)
Compute the bounded start..end keys for a given hashed prefix under an index id.
End is exclusive and created by appending a single 0xFF..0xFF block to the prefix.
The returned range can be used with BTreeMap::range.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for IndexKey
impl<'de> Deserialize<'de> for IndexKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for IndexKey
impl Ord for IndexKey
Source§impl PartialOrd for IndexKey
impl PartialOrd for IndexKey
Source§impl Storable for IndexKey
impl Storable for IndexKey
Source§fn to_bytes(&self) -> Cow<'_, [u8]>
fn to_bytes(&self) -> Cow<'_, [u8]>
Converts the element into a possibly borrowed byte slice. Read more
Source§fn from_bytes(bytes: Cow<'_, [u8]>) -> Self
fn from_bytes(bytes: Cow<'_, [u8]>) -> Self
Converts bytes into an element.
Source§fn to_bytes_checked(&self) -> Cow<'_, [u8]>
fn to_bytes_checked(&self) -> Cow<'_, [u8]>
Like
to_bytes, but checks that bytes conform to declared bounds.Source§fn into_bytes_checked(self) -> Vec<u8> ⓘwhere
Self: Sized,
fn into_bytes_checked(self) -> Vec<u8> ⓘwhere
Self: Sized,
Like
into_bytes, but checks that bytes conform to declared bounds.Source§fn check_bounds(bytes: &[u8])
fn check_bounds(bytes: &[u8])
Validates that a byte slice fits within this type’s declared bounds.
impl Eq for IndexKey
impl StructuralPartialEq for IndexKey
Auto Trait Implementations§
impl Freeze for IndexKey
impl RefUnwindSafe for IndexKey
impl Send for IndexKey
impl Sync for IndexKey
impl Unpin for IndexKey
impl UnwindSafe for IndexKey
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