Trait oasis_core_runtime::common::key_format::KeyFormat
source · pub trait KeyFormat {
// Required methods
fn prefix() -> u8;
fn size() -> usize;
fn encode_atoms(self, atoms: &mut Vec<Vec<u8>>);
fn decode_atoms(data: &[u8]) -> Self
where Self: Sized;
// Provided methods
fn encode_partial(self, count: usize) -> Vec<u8> ⓘ
where Self: Sized { ... }
fn encode(self) -> Vec<u8> ⓘ
where Self: Sized { ... }
fn decode(data: &[u8]) -> Option<Self>
where Self: Sized { ... }
}
Expand description
A key formatting helper trait to be used together with key-value backends for constructing keys.
Required Methods§
sourcefn encode_atoms(self, atoms: &mut Vec<Vec<u8>>)
fn encode_atoms(self, atoms: &mut Vec<Vec<u8>>)
Encode the given key format into a set of atoms.
sourcefn decode_atoms(data: &[u8]) -> Selfwhere
Self: Sized,
fn decode_atoms(data: &[u8]) -> Selfwhere
Self: Sized,
Decode the given key format from data (without prefix).
The caller must ensure that the size of the passed data is at
least the minimum size returned by size
.
Provided Methods§
Object Safety§
This trait is not object safe.