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>(key: impl Into<Key>) -> DataKeywhere
E: EntityKind,
pub fn new<E>(key: impl Into<Key>) -> DataKeywhere
E: EntityKind,
Build a data key for the given entity type and primary key.
pub const fn lower_bound<E>() -> DataKeywhere
E: EntityKind,
pub const fn upper_bound<E>() -> DataKeywhere
E: EntityKind,
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() -> DataKey
pub fn max_storable() -> DataKey
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<DataKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DataKey, <__D as Deserializer<'de>>::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 Serialize for DataKey
impl Serialize for DataKey
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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 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