wasmbus_rpc::cbor

Struct Decoder

Source
pub struct Decoder<'b> { /* private fields */ }

Implementations§

Source§

impl<'b> Decoder<'b>

A non-allocating CBOR decoder

Source

pub fn new(bytes: &'b [u8]) -> Self

Construct a Decoder for the given byte slice

Source

pub fn bool(&mut self) -> RpcResult<bool>

Decode a bool value

Source

pub fn u8(&mut self) -> RpcResult<u8>

Decode a u8 value

Source

pub fn u16(&mut self) -> RpcResult<u16>

Decode a u16 value

Source

pub fn u32(&mut self) -> RpcResult<u32>

Decode a u32 value

Source

pub fn u64(&mut self) -> RpcResult<u64>

Decode a u64 value

Source

pub fn i8(&mut self) -> RpcResult<i8>

Decode an i8 value

Source

pub fn i16(&mut self) -> RpcResult<i16>

Decode an i16 value

Source

pub fn i32(&mut self) -> RpcResult<i32>

Decode an i32 value

Source

pub fn i64(&mut self) -> RpcResult<i64>

Decode an i64 value

Source

pub fn f32(&mut self) -> RpcResult<f32>

Decode an f32 value

Source

pub fn f64(&mut self) -> RpcResult<f64>

Decode an f64 value

Source

pub fn char(&mut self) -> RpcResult<char>

Decode a char value

Source

pub fn str(&mut self) -> RpcResult<&'b str>

Decode a string slice

Source

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

Decode a null

Source

pub fn bytes(&mut self) -> RpcResult<&'b [u8]>

Decode a byte slice

Source

pub fn array(&mut self) -> RpcResult<Option<u64>>

Begin decoding an array. If the length is known, it is returned as Some. For indefinite arrays, None is returned.

Source

pub fn fixed_array(&mut self) -> RpcResult<u64>

Begin decoding an array of known length

Source

pub fn map(&mut self) -> RpcResult<Option<u64>>

Begin decoding a map. If the size is known, it is returned as Some. For indefinite maps, None is returned.

Source

pub fn fixed_map(&mut self) -> RpcResult<u64>

Begin decoding a map of known size

Source

pub fn datatype(&mut self) -> RpcResult<Type>

Inspect the CBOR type at the current position

Source

pub fn skip(&mut self) -> RpcResult<()>

Skip over the current value

Trait Implementations§

Source§

impl<'b> Clone for Decoder<'b>

Source§

fn clone(&self) -> Decoder<'b>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'b> Debug for Decoder<'b>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'b> Freeze for Decoder<'b>

§

impl<'b> RefUnwindSafe for Decoder<'b>

§

impl<'b> Send for Decoder<'b>

§

impl<'b> Sync for Decoder<'b>

§

impl<'b> Unpin for Decoder<'b>

§

impl<'b> UnwindSafe for Decoder<'b>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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