pub struct DocumentKey {
pub pk: PrimaryKey,
pub sk: SortKey,
}Fields§
§pk: PrimaryKey§sk: SortKeyImplementations§
Source§impl DocumentKey
impl DocumentKey
pub fn new(pk: impl Into<Vec<u8>>, sk: impl Into<Vec<u8>>) -> Self
pub fn from_parts(pk: PrimaryKey, sk: SortKey) -> Self
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encodes (pk, sk) as two escaped components.
A zero byte in a component is encoded as 00 FF; the component
terminator is 00 00. This makes both arbitrary binary data and empty
components order-preserving under bytewise lexicographic comparison.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the length of the canonical encoding without allocating it.
Sourcepub fn decode(encoded: &[u8]) -> Result<Self, KeyCodecError>
pub fn decode(encoded: &[u8]) -> Result<Self, KeyCodecError>
Decodes the exact canonical encoding produced by Self::encode.
Trait Implementations§
Source§impl Clone for DocumentKey
impl Clone for DocumentKey
Source§impl Debug for DocumentKey
impl Debug for DocumentKey
impl Eq for DocumentKey
Source§impl Hash for DocumentKey
impl Hash for DocumentKey
Source§impl Ord for DocumentKey
impl Ord for DocumentKey
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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for DocumentKey
impl PartialEq for DocumentKey
Source§impl PartialOrd for DocumentKey
impl PartialOrd for DocumentKey
impl StructuralPartialEq for DocumentKey
Auto Trait Implementations§
impl Freeze for DocumentKey
impl RefUnwindSafe for DocumentKey
impl Send for DocumentKey
impl Sync for DocumentKey
impl Unpin for DocumentKey
impl UnsafeUnpin for DocumentKey
impl UnwindSafe for DocumentKey
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