IgnoreVisitor

Struct IgnoreVisitor 

Source
pub struct IgnoreVisitor<R>(/* private fields */);
Expand description

A Visitor implementation that just ignores all of the bytes.

Implementations§

Source§

impl<R> IgnoreVisitor<R>

Source

pub fn new() -> Self

Construct a new IgnoreVisitor.

Trait Implementations§

Source§

impl<R> Default for IgnoreVisitor<R>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<R: TypeResolver> Visitor for IgnoreVisitor<R>

Source§

type Value<'scale, 'resolver> = ()

The type of the value to hand back from the decode_with_visitor() function.
Source§

type Error = DecodeError

The error type (which we must be able to convert a combination of Self and DecodeErrors into, to handle any internal errors that crop up trying to decode things).
Source§

type TypeResolver = R

The thing we’ll use to resolve type IDs into concrete types.
Source§

fn visit_unexpected<'scale, 'resolver>( self, _unexpected: Unexpected, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

This is called when a visitor function that you’ve not provided an implementation is called. You are provided an enum value corresponding to the function call, and can decide what to return in this case. The default is to return an error to announce the unexpected value.
Source§

fn unchecked_decode_as_type<'scale, 'resolver>( self, _input: &mut &'scale [u8], _type_id: TypeIdFor<Self>, _types: &'resolver Self::TypeResolver, ) -> DecodeAsTypeResult<Self, Result<Self::Value<'scale, 'resolver>, Self::Error>>

This method is called immediately upon running decode_with_visitor(). By default we ignore this call and return our visitor back (ie [DecodeAsTypeResult::Skipped(visitor)]). If you choose to do some decoding at this stage, return [DecodeAsTypeResult::Decoded(result)]. In either case, any bytes that you consume from the input (by altering what it points to) will be consumed for any subsequent visiting. Read more
Source§

fn visit_bool<'scale, 'resolver>( self, _value: bool, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a bool is seen in the input bytes.
Source§

fn visit_char<'scale, 'resolver>( self, _value: char, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a char is seen in the input bytes.
Source§

fn visit_u8<'scale, 'resolver>( self, _value: u8, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a u8 is seen in the input bytes.
Source§

fn visit_u16<'scale, 'resolver>( self, _value: u16, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a u16 is seen in the input bytes.
Source§

fn visit_u32<'scale, 'resolver>( self, _value: u32, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a u32 is seen in the input bytes.
Source§

fn visit_u64<'scale, 'resolver>( self, _value: u64, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a u64 is seen in the input bytes.
Source§

fn visit_u128<'scale, 'resolver>( self, _value: u128, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a u128 is seen in the input bytes.
Source§

fn visit_u256<'resolver>( self, _value: &[u8; 32], _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'_, 'resolver>, Self::Error>

Called when a u256 is seen in the input bytes.
Source§

fn visit_i8<'scale, 'resolver>( self, _value: i8, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when an i8 is seen in the input bytes.
Source§

fn visit_i16<'scale, 'resolver>( self, _value: i16, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when an i16 is seen in the input bytes.
Source§

fn visit_i32<'scale, 'resolver>( self, _value: i32, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when an i32 is seen in the input bytes.
Source§

fn visit_i64<'scale, 'resolver>( self, _value: i64, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when an i64 is seen in the input bytes.
Source§

fn visit_i128<'scale, 'resolver>( self, _value: i128, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when an i128 is seen in the input bytes.
Source§

fn visit_i256<'resolver>( self, _value: &[u8; 32], _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'_, 'resolver>, Self::Error>

Called when an i256 is seen in the input bytes.
Source§

fn visit_sequence<'scale, 'resolver>( self, _value: &mut Sequence<'scale, 'resolver, Self::TypeResolver>, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a sequence of values is seen in the input bytes.
Source§

fn visit_composite<'scale, 'resolver>( self, _value: &mut Composite<'scale, 'resolver, Self::TypeResolver>, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a composite value is seen in the input bytes.
Source§

fn visit_tuple<'scale, 'resolver>( self, _value: &mut Tuple<'scale, 'resolver, Self::TypeResolver>, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a tuple of values is seen in the input bytes.
Source§

fn visit_str<'scale, 'resolver>( self, _value: &mut Str<'scale>, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a string value is seen in the input bytes.
Source§

fn visit_variant<'scale, 'resolver>( self, _value: &mut Variant<'scale, 'resolver, Self::TypeResolver>, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a variant is seen in the input bytes.
Source§

fn visit_array<'scale, 'resolver>( self, _value: &mut Array<'scale, 'resolver, Self::TypeResolver>, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when an array is seen in the input bytes.
Source§

fn visit_bitsequence<'scale, 'resolver>( self, _value: &mut BitSequence<'scale>, _type_id: TypeIdFor<Self>, ) -> Result<Self::Value<'scale, 'resolver>, Self::Error>

Called when a bit sequence is seen in the input bytes.

Auto Trait Implementations§

§

impl<R> Freeze for IgnoreVisitor<R>

§

impl<R> RefUnwindSafe for IgnoreVisitor<R>
where R: RefUnwindSafe,

§

impl<R> Send for IgnoreVisitor<R>
where R: Send,

§

impl<R> Sync for IgnoreVisitor<R>
where R: Sync,

§

impl<R> Unpin for IgnoreVisitor<R>
where R: Unpin,

§

impl<R> UnwindSafe for IgnoreVisitor<R>
where R: 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, 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, 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.