Skip to main content

WireFormat

Trait WireFormat 

Source
pub trait WireFormat: Send {
    // Required methods
    fn byte_size(&self) -> u32;
    fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
       where Self: Sized;
    fn decode<R: Read>(reader: &mut R) -> Result<Self>
       where Self: Sized;
}
Expand description

A type that can be encoded on the wire using the 9P protocol.

Required Methods§

Source

fn byte_size(&self) -> u32

Returns the number of bytes necessary to fully encode self.

Source

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Encodes self into writer.

Source

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

Decodes Self from reader.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WireFormat for ()

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>

Source§

fn decode<R: Read>(_reader: &mut R) -> Result<Self>

Source§

impl WireFormat for IpAddr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for Ipv4Addr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for Ipv6Addr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for SocketAddr

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl WireFormat for SocketAddrV4

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for SocketAddrV6

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for String

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for SystemTime

Implement WireFormat for SystemTime, must be used with care as it can lead to overflow errors on Windows.

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl WireFormat for Url

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl WireFormat for bool

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for f32

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for f64

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for i16

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for i32

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for i64

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for i128

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for isize

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for u8

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for u16

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for u32

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for u64

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for u128

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl WireFormat for usize

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> WireFormat for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K> WireFormat for (A, B, C, D, E, F, G, H, I, J, K)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E, F, G, H, I, J> WireFormat for (A, B, C, D, E, F, G, H, I, J)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E, F, G, H, I> WireFormat for (A, B, C, D, E, F, G, H, I)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E, F, G, H> WireFormat for (A, B, C, D, E, F, G, H)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E, F, G> WireFormat for (A, B, C, D, E, F, G)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E, F> WireFormat for (A, B, C, D, E, F)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D, E> WireFormat for (A, B, C, D, E)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C, D> WireFormat for (A, B, C, D)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B, C> WireFormat for (A, B, C)
where A: WireFormat, B: WireFormat, C: WireFormat,

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A, B> WireFormat for (A, B)
where A: WireFormat, B: WireFormat,

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<A: WireFormat> WireFormat for (A,)

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<K: WireFormat + Send + Sync + Ord + Eq + Hash, V: WireFormat + Send + Sync> WireFormat for HashMap<K, V>

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl<K: WireFormat + Send + Sync + Ord, V: WireFormat + Send + Sync> WireFormat for BTreeMap<K, V>

Available on crate feature std only.
Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl<T: WireFormat + Send + Sync + Eq + Hash> WireFormat for HashSet<T>

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl<T: WireFormat> WireFormat for Box<T>

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl<T: WireFormat> WireFormat for PhantomData<T>

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, _writer: &mut W) -> Result<()>
where Self: Sized,

Source§

fn decode<R: Read>(_reader: &mut R) -> Result<Self>
where Self: Sized,

Source§

impl<T: WireFormat> WireFormat for Vec<T>

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<T> WireFormat for Option<T>
where T: WireFormat,

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R: Read>(reader: &mut R) -> Result<Self>

Source§

impl<V: WireFormat + Send + Sync + Ord> WireFormat for BTreeSet<V>

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl<V: WireFormat + Send + Sync + Ord> WireFormat for BinaryHeap<V>

Available on crate feature std only.
Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Source§

impl<V: WireFormat + Send + Sync + Ord> WireFormat for VecDeque<V>

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W: Write>(&self, writer: &mut W) -> Result<()>
where Self: Sized,

Source§

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

Implementors§

Source§

impl WireFormat for Data

Source§

impl WireFormat for P9String

Source§

impl<T, I> WireFormat for Wrapped<T, I>
where T: Send + AsRef<I>, I: WireFormat + Into<T>,

Available on non-WebAssembly only.