pub struct JsonCodec;Expand description
A StateCodec that uses serde_json for all keys and values.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsonCodec
impl<'de> Deserialize<'de> for JsonCodec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl StateCodec for JsonCodec
impl StateCodec for JsonCodec
Source§type KeyCodec = JsonCodec
type KeyCodec = JsonCodec
The codec used to serialize keys. See
StateKeyCodec.Source§type ValueCodec = JsonCodec
type ValueCodec = JsonCodec
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 JsonCodecwhere
K: Serialize,
impl<K> StateKeyCodec<K> for JsonCodecwhere
K: Serialize,
Source§impl<V> StateValueCodec<V> for JsonCodecwhere
V: Serialize + for<'a> Deserialize<'a>,
impl<V> StateValueCodec<V> for JsonCodecwhere
V: Serialize + for<'a> Deserialize<'a>,
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 JsonCodec
impl StructuralPartialEq for JsonCodec
Auto Trait Implementations§
impl Freeze for JsonCodec
impl RefUnwindSafe for JsonCodec
impl Send for JsonCodec
impl Sync for JsonCodec
impl Unpin for JsonCodec
impl UnwindSafe for JsonCodec
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