cuprate_epee_encoding

Trait EpeeValue

Source
pub trait EpeeValue: Sized {
    const MARKER: Marker;

    // Required methods
    fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>;
    fn write<B: BufMut>(self, w: &mut B) -> Result<()>;

    // Provided methods
    fn should_write(&self) -> bool { ... }
    fn epee_default_value() -> Option<Self> { ... }
}
Expand description

A trait for epee values.

All EpeeObject objects automatically implement EpeeValue.

Required Associated Constants§

Required Methods§

Source

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Provided Methods§

Source

fn should_write(&self) -> bool

Source

fn epee_default_value() -> Option<Self>

This is different than default field values and instead is the default value of a whole type.

For example a Vec has a default value of a zero length vec as when a sequence has no entries it is not encoded.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EpeeValue for bool

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for f64

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for i8

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for i16

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for i32

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for i64

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for u8

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for u16

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for u32

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for u64

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Bytes

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn epee_default_value() -> Option<Self>

Source§

fn should_write(&self) -> bool

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for BytesMut

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn epee_default_value() -> Option<Self>

Source§

fn should_write(&self) -> bool

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for String

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<bool>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<f64>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<i8>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<i16>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<i32>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<i64>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<u8>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn epee_default_value() -> Option<Self>

Source§

fn should_write(&self) -> bool

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<u16>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<u32>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<u64>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<Bytes>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<BytesMut>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<String>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl EpeeValue for Vec<Vec<u8>>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<T: EpeeObject + Debug, const N: usize> EpeeValue for [T; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<T: EpeeObject> EpeeValue for Vec<T>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<T: EpeeValue> EpeeValue for Option<T>

Source§

const MARKER: Marker = T::MARKER

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for ByteArray<N>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for ByteArrayVec<N>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn epee_default_value() -> Option<Self>

Source§

fn should_write(&self) -> bool

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for Vec<[u8; N]>

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn should_write(&self) -> bool

Source§

fn epee_default_value() -> Option<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [bool; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [f64; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [i8; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [i16; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [i32; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [i64; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [u8; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [u16; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [u32; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [u64; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [Bytes; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [BytesMut; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [String; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Source§

impl<const N: usize> EpeeValue for [Vec<u8>; N]

Source§

const MARKER: Marker = _

Source§

fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>

Source§

fn write<B: BufMut>(self, w: &mut B) -> Result<()>

Implementors§