pub struct BorshCodec;
Expand description
A StateCodec
that uses borsh
for all keys and values.
Trait Implementations§
Source§impl BorshDeserialize for BorshCodec
impl BorshDeserialize for BorshCodec
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for BorshCodec
impl BorshSerialize for BorshCodec
Source§impl Clone for BorshCodec
impl Clone for BorshCodec
Source§fn clone(&self) -> BorshCodec
fn clone(&self) -> BorshCodec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for BorshCodec
impl Debug for BorshCodec
Source§impl Default for BorshCodec
impl Default for BorshCodec
Source§fn default() -> BorshCodec
fn default() -> BorshCodec
Returns the “default value” for a type. Read more
Source§impl<T> EncodeKeyLike<[T], Vec<T>> for BorshCodecwhere
T: BorshSerialize,
impl<T> EncodeKeyLike<[T], Vec<T>> for BorshCodecwhere
T: BorshSerialize,
Source§impl PartialEq for BorshCodec
impl PartialEq for BorshCodec
Source§impl StateCodec for BorshCodec
impl StateCodec for BorshCodec
Source§type KeyCodec = BorshCodec
type KeyCodec = BorshCodec
The codec used to serialize keys. See
StateKeyCodec
.Source§type ValueCodec = BorshCodec
type ValueCodec = BorshCodec
The codec used to serialize and deserialize values. See
StateValueCodec
.Source§fn value_codec(&self) -> &Self::ValueCodec
fn value_codec(&self) -> &Self::ValueCodec
Returns a reference to the type’s value codec.
Source§impl<K> StateKeyCodec<K> for BorshCodecwhere
K: BorshSerialize + BorshDeserialize,
impl<K> StateKeyCodec<K> for BorshCodecwhere
K: BorshSerialize + BorshDeserialize,
Source§impl<V> StateValueCodec<V> for BorshCodecwhere
V: BorshSerialize + BorshDeserialize,
impl<V> StateValueCodec<V> for BorshCodecwhere
V: BorshSerialize + BorshDeserialize,
Source§fn encode_value(&self, value: &V) -> Vec<u8> ⓘ
fn encode_value(&self, value: &V) -> Vec<u8> ⓘ
Serializes a value into a bytes vector. Read more
Source§fn try_decode_value(&self, bytes: &[u8]) -> Result<V, Self::Error>
fn try_decode_value(&self, bytes: &[u8]) -> Result<V, Self::Error>
Tries to deserialize a value from a bytes slice, and returns a
Result
with either the deserialized value or an error.Source§fn decode_value_unwrap(&self, bytes: &[u8]) -> V
fn decode_value_unwrap(&self, bytes: &[u8]) -> V
Deserializes a value from a bytes slice. Read more
impl Eq for BorshCodec
impl StructuralPartialEq for BorshCodec
Auto Trait Implementations§
impl Freeze for BorshCodec
impl RefUnwindSafe for BorshCodec
impl Send for BorshCodec
impl Sync for BorshCodec
impl Unpin for BorshCodec
impl UnwindSafe for BorshCodec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C, T> EncodeKeyLike<T, T> for Cwhere
C: StateKeyCodec<T>,
impl<C, T> EncodeKeyLike<T, T> for Cwhere
C: StateKeyCodec<T>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more