pub struct DataKey { /* private fields */ }Expand description
DataKey
Implementations§
Source§impl DataKey
impl DataKey
pub const STORABLE_MAX_SIZE: u32 = 160u32
Sourcepub fn new<E: EntityKind>(key: impl Into<Key>) -> Self
pub fn new<E: EntityKind>(key: impl Into<Key>) -> Self
Build a data key for the given entity type and primary key.
pub const fn lower_bound<E: EntityKind>() -> Self
pub const fn upper_bound<E: EntityKind>() -> Self
Sourcepub const fn entity_id(&self) -> u64
pub const fn entity_id(&self) -> u64
Entity identifier (stable, compile-time constant per entity type).
Sourcepub const fn entry_size_bytes(value_len: u64) -> u64
pub const fn entry_size_bytes(value_len: u64) -> u64
Compute the on-disk size used by a single data entry from its value length.
Includes the bounded DataKey size and the value bytes.
Sourcepub fn max_storable() -> Self
pub fn max_storable() -> Self
Max sentinel key for sizing.
Trait Implementations§
Source§impl CandidType for DataKey
impl CandidType for DataKey
Source§impl<'de> Deserialize<'de> for DataKey
impl<'de> Deserialize<'de> for DataKey
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 DataKey
impl Ord for DataKey
Source§impl PartialOrd for DataKey
impl PartialOrd for DataKey
Source§impl Storable for DataKey
impl Storable for DataKey
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 DataKey
impl StructuralPartialEq for DataKey
Auto Trait Implementations§
impl Freeze for DataKey
impl RefUnwindSafe for DataKey
impl Send for DataKey
impl Sync for DataKey
impl Unpin for DataKey
impl UnwindSafe for DataKey
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