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.

Implementations on Foreign Types§

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 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 ()

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 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 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 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 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 LabeledSpan

r[impl jetstream.miette.wireformat.labeled_span] LabeledSpan is encoded as:

  • label: Option<String>
  • span: SourceSpan (offset + length as usize)
  • primary: bool
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 MietteDiagnostic

r[impl jetstream.miette.wireformat.miette_diagnostic] MietteDiagnostic is encoded as:

  • message: String
  • code: Option<String>
  • severity: Option<Severity>
  • help: Option<String>
  • url: Option<String>
  • labels: Option<Vec<LabeledSpan>>
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 Severity

r[impl jetstream.miette.wireformat.severity] Severity is encoded as a single byte:

  • 0: Advice
  • 1: Warning
  • 2: Error
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 SourceOffset

r[impl jetstream.miette.wireformat.source_offset]

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 SourceSpan

r[impl jetstream.miette.wireformat.source_span] SourceSpan is encoded as offset (usize) followed by length (usize).

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 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<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 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> 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<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 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 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.