Trait cuprate_epee_encoding::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.

Object Safety§

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§