wasmbus_rpc::cbor

Struct Encoder

Source
pub struct Encoder<W: Write> {
    pub inner: Encoder<W>,
}

Fields§

§inner: Encoder<W>

Implementations§

Source§

impl<W> Encoder<W>
where W::Error: Display, W: Write,

A non-allocating CBOR encoder

Source

pub fn new(writer: W) -> Self

Constructs an Encoder around the writer

Source

pub fn bool(&mut self, x: bool) -> RpcResult<&mut Self>

Encode a bool value

Source

pub fn u8(&mut self, x: u8) -> RpcResult<&mut Self>

Encode a u8 value

Source

pub fn u16(&mut self, x: u16) -> RpcResult<&mut Self>

Encode a u16 value

Source

pub fn u32(&mut self, x: u32) -> RpcResult<&mut Self>

Encode a u32 value

Source

pub fn u64(&mut self, x: u64) -> RpcResult<&mut Self>

Encode a u64 value

Source

pub fn i8(&mut self, x: i8) -> RpcResult<&mut Self>

Encode an i8 value

Source

pub fn i16(&mut self, x: i16) -> RpcResult<&mut Self>

Encode an i16 value

Source

pub fn i32(&mut self, x: i32) -> RpcResult<&mut Self>

Encode an i32 value

Source

pub fn i64(&mut self, x: i64) -> RpcResult<&mut Self>

Encode an i64 value

Source

pub fn f32(&mut self, x: f32) -> RpcResult<&mut Self>

Encode an f32 value

Source

pub fn f64(&mut self, x: f64) -> RpcResult<&mut Self>

Encode an f64 value

Source

pub fn char(&mut self, x: char) -> RpcResult<&mut Self>

Encode a char value

Source

pub fn bytes(&mut self, x: &[u8]) -> RpcResult<&mut Self>

Encode a byte slice

Source

pub fn str(&mut self, x: &str) -> RpcResult<&mut Self>

Encode a string slice

Source

pub fn null(&mut self) -> RpcResult<&mut Self>

Encode a null

Source

pub fn array(&mut self, len: u64) -> RpcResult<&mut Self>

Begin encoding an array with len elements

Source

pub fn begin_array(&mut self) -> RpcResult<&mut Self>

Begin encoding an array with indefinite length

Source

pub fn map(&mut self, len: u64) -> RpcResult<&mut Self>

Begin encoding a map with len elements

Source

pub fn begin_map(&mut self) -> RpcResult<&mut Self>

Begin encoding a map with indefinite length

Source

pub fn begin_bytes(&mut self) -> RpcResult<&mut Self>

Begin encoding a byte slice with indefinite length Use Encoder::end to terminate

Source

pub fn begin_str(&mut self) -> RpcResult<&mut Self>

Begin encoding an indefinite number of string slices Use Encoder::end to terminate

Source

pub fn end(&mut self) -> RpcResult<&mut Self>

Terminate an indefinite collection

Source

pub fn into_inner(self) -> W

Returns the inner writer

Source

pub fn tag(&mut self, tag: u64) -> RpcResult<&mut Self>

Write a tag

Auto Trait Implementations§

§

impl<W> Freeze for Encoder<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for Encoder<W>
where W: RefUnwindSafe,

§

impl<W> Send for Encoder<W>
where W: Send,

§

impl<W> Sync for Encoder<W>
where W: Sync,

§

impl<W> Unpin for Encoder<W>
where W: Unpin,

§

impl<W> UnwindSafe for Encoder<W>
where W: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T