Struct candid::de::IDLDeserialize

source ·
pub struct IDLDeserialize<'de> { /* private fields */ }
Expand description

Use this struct to deserialize a sequence of Rust values (heterogeneous) from IDL binary message.

Implementations§

source§

impl<'de> IDLDeserialize<'de>

source

pub fn new(bytes: &'de [u8]) -> Result<Self>

Create a new deserializer with IDL binary message.

source

pub fn new_with_config(bytes: &'de [u8], config: &DecoderConfig) -> Result<Self>

Create a new deserializer with IDL binary message. The config is used to adjust some parameters in the deserializer.

source

pub fn get_value<T>(&mut self) -> Result<T>
where T: Deserialize<'de> + CandidType,

Deserialize one value from deserializer.

source

pub fn get_value_with_type( &mut self, env: &TypeEnv, expected_type: &Type ) -> Result<IDLValue>

Available on crate feature value only.

Deserialize one value as IDLValue from deserializer. Note that expected_type should not contain TypeInner::Knot.

source

pub fn is_done(&self) -> bool

Check if we finish deserializing all values.

source

pub fn done(&mut self) -> Result<()>

Return error if there are unprocessed bytes in the input.

source

pub fn get_config(&self) -> DecoderConfig

Return the current DecoderConfig, mainly to extract the remaining quota.

Auto Trait Implementations§

§

impl<'de> Freeze for IDLDeserialize<'de>

§

impl<'de> RefUnwindSafe for IDLDeserialize<'de>

§

impl<'de> !Send for IDLDeserialize<'de>

§

impl<'de> !Sync for IDLDeserialize<'de>

§

impl<'de> Unpin for IDLDeserialize<'de>

§

impl<'de> UnwindSafe for IDLDeserialize<'de>

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

§

type Output = T

Should always be Self
source§

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

§

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

§

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.