Struct sov_state::codec::BorshCodec

source ·
pub struct BorshCodec;
Expand description

A StateValueCodec that uses borsh for all values.

Trait Implementations§

source§

impl BorshDeserialize for BorshCodec

source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

source§

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>

Deserialize this instance from a slice of bytes.
source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where R: Read,

source§

impl BorshSerialize for BorshCodec

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

source§

fn try_to_vec(&self) -> Result<Vec<u8, Global>, Error>

Serialize this instance into a vector of bytes.
source§

impl Clone for BorshCodec

source§

fn clone(&self) -> BorshCodec

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BorshCodec

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for BorshCodec

source§

fn default() -> BorshCodec

Returns the “default value” for a type. Read more
source§

impl<T> EncodeKeyLike<[T], Vec<T, Global>> for BorshCodecwhere T: BorshSerialize,

source§

fn encode_key_like(&self, borrowed: &[T]) -> Vec<u8>

Encodes a reference to Ref as if it were a reference to Target.
source§

impl PartialEq<BorshCodec> for BorshCodec

source§

fn eq(&self, other: &BorshCodec) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StateCodec for BorshCodec

§

type KeyCodec = BorshCodec

The codec used to serialize keys
§

type ValueCodec = BorshCodec

The codec used to serialize and deserialize values
source§

fn key_codec(&self) -> &Self::KeyCodec

Returns a reference to the type’s key codec
source§

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,

source§

fn encode_key(&self, value: &K) -> Vec<u8>

source§

impl<V> StateValueCodec<V> for BorshCodecwhere V: BorshSerialize + BorshDeserialize,

§

type Error = Error

Error type that can arise during deserialization.
source§

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>

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

Deserializes a value from a bytes slice. Read more
source§

impl Eq for BorshCodec

source§

impl StructuralEq for BorshCodec

source§

impl StructuralPartialEq for BorshCodec

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<C, T> EncodeKeyLike<T, T> for Cwhere C: StateKeyCodec<T>,

source§

fn encode_key_like(&self, borrowed: &T) -> Vec<u8, Global>

Encodes a reference to Ref as if it were a reference to Target.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more