Skip to main content

WireFormat

Trait WireFormat 

Source
pub trait WireFormat: Send {
    // Required methods
    fn byte_size(&self) -> u32;
    fn encode<W>(&self, writer: &mut W) -> Result<(), Error>
       where W: Write,
             Self: Sized;
    fn decode<R>(reader: &mut R) -> Result<Self, Error>
       where R: Read,
             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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write, Self: Sized,

Encodes self into writer.

Source

fn decode<R>(reader: &mut R) -> Result<Self, Error>
where R: Read, 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>(&self, _writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

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

Source§

impl WireFormat for Error

r[impl jetstream.error.v2.wireformat] r[impl jetstream.error.v2.wireformat.message] r[impl jetstream.error.v2.wireformat.code] r[impl jetstream.error.v2.wireformat.backtrace]

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for IpAddr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for Ipv4Addr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for Ipv6Addr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for NodeAddr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for NodeId

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for Rerror

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for Rlerror

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for SocketAddr

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for SocketAddrV4

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for SocketAddrV6

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for String

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write, SystemTime: Sized,

Source§

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

Source§

impl WireFormat for TlsCert

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for TlsPeer

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for TransportAddr

Available on crate feature iroh only.
Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R>(reader: &mut R) -> Result<TransportAddr, Error>

Source§

impl WireFormat for Url

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for WebCredentials

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R>(reader: &mut R) -> Result<WebCredentials, Error>

Source§

impl WireFormat for bool

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for f32

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for f64

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for i16

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for i32

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for i64

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for i128

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for isize

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for u8

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for u16

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for u32

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for u64

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for u128

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

impl WireFormat for usize

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>( reader: &mut R, ) -> Result<(A, B, C, D, E, F, G, H, I, J, K, L), Error>
where R: Read,

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D, E, F, G, H, I, J, K), Error>
where R: Read,

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D, E, F, G, H, I, J), Error>
where R: Read,

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D, E, F, G, H, I), Error>
where R: Read,

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D, E, F, G, H), Error>
where R: Read,

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D, E, F, G), Error>
where R: Read,

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D, E, F), Error>
where R: Read,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D, E), Error>
where R: Read,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C, D), Error>
where R: Read,

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>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B, C), Error>
where R: Read,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R>(reader: &mut R) -> Result<(A, B), Error>
where R: Read,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

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

Available on crate feature std only.
Source§

fn byte_size(&self) -> u32

Source§

fn encode<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write, BTreeMap<K, V>: Sized,

Source§

fn decode<R>(reader: &mut R) -> Result<BTreeMap<K, V>, Error>
where R: Read, BTreeMap<K, V>: Sized,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

fn encode<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write, HashMap<K, V>: Sized,

Source§

fn decode<R>(reader: &mut R) -> Result<HashMap<K, V>, Error>
where R: Read, HashMap<K, V>: Sized,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R>(reader: &mut R) -> Result<Option<T>, Error>
where R: Read,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

fn decode<R>(reader: &mut R) -> Result<Vec<T>, Error>
where R: Read,

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

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

Available on crate feature std only.
Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Source§

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

Source§

fn byte_size(&self) -> u32

Source§

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

Source§

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

Implementors§

Source§

impl WireFormat for Data

Source§

impl WireFormat for Dirent

Source§

impl WireFormat for P9String

Source§

impl WireFormat for Qid

Source§

impl WireFormat for Rattach

Source§

impl WireFormat for Rauth

Source§

impl WireFormat for jetstream::p9::Rerror

Source§

impl WireFormat for Rframe

Source§

impl WireFormat for Rgetattr

Source§

impl WireFormat for Rgetlock

Source§

impl WireFormat for Rlcreate

Source§

impl WireFormat for jetstream::p9::Rlerror

Source§

impl WireFormat for Rlock

Source§

impl WireFormat for Rlopen

Source§

impl WireFormat for Rmkdir

Source§

impl WireFormat for Rmknod

Source§

impl WireFormat for Rread

Source§

impl WireFormat for Rreaddir

Source§

impl WireFormat for Rstatfs

Source§

impl WireFormat for jetstream::prelude::Rversion

Source§

impl WireFormat for jetstream::p9::Rversion

Source§

impl WireFormat for Rwalk

Source§

impl WireFormat for Rwrite

Source§

impl WireFormat for Rxattrwalk

Source§

impl WireFormat for Tattach

Source§

impl WireFormat for Tauth

Source§

impl WireFormat for Tclunk

Source§

impl WireFormat for Tflush

Source§

impl WireFormat for Tframe

Source§

impl WireFormat for Tfsync

Source§

impl WireFormat for Tgetattr

Source§

impl WireFormat for Tgetlock

Source§

impl WireFormat for Tlcreate

Source§

impl WireFormat for Tlock

Source§

impl WireFormat for Tlopen

Source§

impl WireFormat for Tmkdir

Source§

impl WireFormat for Tmknod

Source§

impl WireFormat for Tread

Source§

impl WireFormat for Treaddir

Source§

impl WireFormat for Tremove

Source§

impl WireFormat for Trename

Source§

impl WireFormat for Trenameat

Source§

impl WireFormat for Tsetattr

Source§

impl WireFormat for Tstatfs

Source§

impl WireFormat for Tunlinkat

Source§

impl WireFormat for jetstream::prelude::Tversion

Source§

impl WireFormat for jetstream::p9::Tversion

Source§

impl WireFormat for Twalk

Source§

impl WireFormat for Twrite

Source§

impl WireFormat for Txattrcreate

Source§

impl WireFormat for Txattrwalk

Source§

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

Available on non-WebAssembly only.
Source§

impl<T> WireFormat for Frame<T>
where T: Framer,