Decoder

Struct Decoder 

Source
pub struct Decoder<R> { /* private fields */ }
Expand description

A decoder for decoding lilliput-encoded values.

Implementations§

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_bool(&mut self) -> Result<bool>
where R: Read<'de>,

Decodes a boolean value.

Source

pub fn decode_bool_value(&mut self) -> Result<BoolValue>

Decodes a boolean value, as a BoolValue.

Source

pub fn decode_bool_header(&mut self) -> Result<BoolHeader>

Decodes a boolean value’s header.

Source

pub fn skip_bool_value_of(&mut self, header: BoolHeader) -> Result<()>
where R: Read<'de>,

Skips the boolean value for a given header.

Source

pub fn decode_bool_value_of(&mut self, header: BoolHeader) -> Result<BoolValue>

Decodes boolean value for a given header, as a BoolValue.

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_bytes<'s>( &'s mut self, scratch: &'s mut Vec<u8>, ) -> Result<Reference<'de, 's, [u8]>>

Decodes a byte array value, as a slice reference.

Source

pub fn decode_bytes_buf(&mut self) -> Result<Vec<u8>>

Decodes a byte array value, as an owned buffer.

Source

pub fn decode_bytes_value(&mut self) -> Result<BytesValue>

Decodes a byte array value, as a BytesValue.

Source

pub fn decode_bytes_header(&mut self) -> Result<BytesHeader>

Decodes a byte array value’s header.

Source

pub fn skip_bytes_value_of(&mut self, header: BytesHeader) -> Result<()>
where R: Read<'de>,

Skips the byte array value for a given header.

Source

pub fn decode_bytes_value_of( &mut self, header: BytesHeader, ) -> Result<BytesValue>

Decodes byte array value for a given header, as a BytesValue.

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_f32(&mut self) -> Result<f32>

Decodes a 32-bit floating-point value.

Source

pub fn decode_f64(&mut self) -> Result<f64>

Decodes a 64-bit floating-point value.

Source

pub fn decode_float_value(&mut self) -> Result<FloatValue>

Decodes a floating-point value, as a FloatValue.

Source

pub fn decode_float_header(&mut self) -> Result<FloatHeader>

Decodes a floating-point value’s header.

Source

pub fn skip_float_value_of(&mut self, header: FloatHeader) -> Result<()>

Skips the floating-point value for a given header.

Source

pub fn decode_float_value_of( &mut self, header: FloatHeader, ) -> Result<FloatValue>

Decodes floating-point value for a given header, as a FloatValue.

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_i8(&mut self) -> Result<i8>

Decodes a 8-bit signed integer value.

Source

pub fn decode_i16(&mut self) -> Result<i16>

Decodes a 16-bit signed integer value.

Source

pub fn decode_i32(&mut self) -> Result<i32>

Decodes a 32-bit signed integer value.

Source

pub fn decode_i64(&mut self) -> Result<i64>

Decodes a 64-bit signed integer value.

Source

pub fn decode_u8(&mut self) -> Result<u8>

Decodes a 8-bit unsigned integer value.

Source

pub fn decode_u16(&mut self) -> Result<u16>

Decodes a 16-bit unsigned integer value.

Source

pub fn decode_u32(&mut self) -> Result<u32>

Decodes a 32-bit unsigned integer value.

Source

pub fn decode_u64(&mut self) -> Result<u64>

Decodes a 64-bit unsigned integer value.

Source

pub fn decode_signed_int<T>(&mut self) -> Result<T>

Decodes a signed integer value.

Source

pub fn decode_unsigned_int<T>(&mut self) -> Result<T>

Decodes a unsigned integer value.

Source

pub fn decode_signed_int_value(&mut self) -> Result<SignedIntValue>

Decodes a signed integer value, as a SignedIntValue.

Source

pub fn decode_unsigned_int_value(&mut self) -> Result<UnsignedIntValue>

Decodes a unsigned integer value, as a UnsignedIntValue.

Source

pub fn decode_int_value(&mut self) -> Result<IntValue>

Decodes a integer value, as an IntValue.

Source

pub fn decode_int_header(&mut self) -> Result<IntHeader>

Decodes a integer value’s header.

Source

pub fn skip_int_value_of(&mut self, header: IntHeader) -> Result<()>

Skips the integer value for a given header.

Source

pub fn decode_int_value_of(&mut self, header: IntHeader) -> Result<IntValue>

Decodes integer value for a given header, as an IntValue.

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_map(&mut self) -> Result<Map>

Decodes a map value.

Source

pub fn decode_map_value(&mut self) -> Result<MapValue>

Decodes a map value, as a MapValue.

Source

pub fn decode_map_header(&mut self) -> Result<MapHeader>

Decodes a map value’s header.

Source

pub fn skip_map_value_of(&mut self, header: MapHeader) -> Result<()>

Skips the map value for a given header.

Source

pub fn decode_map_value_of(&mut self, header: MapHeader) -> Result<MapValue>

Decodes map value for a given header, as a MapValue.

Source§

impl<'r, R> Decoder<R>
where R: Read<'r>,

Source

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

Decodes a null value.

Source

pub fn decode_null_value(&mut self) -> Result<NullValue>

Decodes a null value, as a NullValue.

Source

pub fn decode_null_header(&mut self) -> Result<NullHeader>

Decodes a null value’s header.

Source

pub fn skip_null_value_of(&mut self, header: NullHeader) -> Result<()>

Skips the null value for a given header.

Source

pub fn decode_null_value_of(&mut self, header: NullHeader) -> Result<NullValue>

Decodes null value for a given header, as a NullValue.

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_seq(&mut self) -> Result<Seq>

Decodes a sequence value.

Source

pub fn decode_seq_value(&mut self) -> Result<SeqValue>

Decodes a sequence value, as a SeqValue.

Source

pub fn decode_seq_header(&mut self) -> Result<SeqHeader>

Decodes a sequence value’s header.

Source

pub fn skip_seq_value_of(&mut self, header: SeqHeader) -> Result<()>

Skips the sequence value for a given header.

Source

pub fn decode_seq_value_of(&mut self, header: SeqHeader) -> Result<SeqValue>

Decodes sequence value for a given header, as a SeqValue.

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_str<'s>( &'s mut self, scratch: &'s mut Vec<u8>, ) -> Result<Reference<'de, 's, str>>

Decodes a string value, as a reference.

Source

pub fn decode_str_bytes<'s>( &'s mut self, scratch: &'s mut Vec<u8>, ) -> Result<Reference<'de, 's, [u8]>>

Decodes a string value’s raw-bytes, as a reference.

Source

pub fn decode_string(&mut self) -> Result<String>

Decodes a string value, as an owned string.

Source

pub fn decode_string_bytes_buf(&mut self) -> Result<Vec<u8>>

Decodes a string value’s raw-bytes, as an owned buffer.

Source

pub fn decode_string_value(&mut self) -> Result<StringValue>

Decodes a string value, as a StringValue.

Source

pub fn decode_string_header(&mut self) -> Result<StringHeader>

Decodes a string value’s header.

Source

pub fn skip_string_value_of(&mut self, header: StringHeader) -> Result<()>

Skips the map value for a given header.

Source

pub fn decode_string_value_of( &mut self, header: StringHeader, ) -> Result<StringValue>

Decodes map value for a given header, as a MapValue.

Source§

impl<'r, R> Decoder<R>
where R: Read<'r>,

Source

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

Decodes a unit value.

Source

pub fn decode_unit_value(&mut self) -> Result<UnitValue>

Decodes a unit value, as a UnitValue.

Source

pub fn decode_unit_header(&mut self) -> Result<UnitHeader>

Decodes a unit value’s header.

Source

pub fn skip_unit_value_of(&mut self, header: UnitHeader) -> Result<()>

Skips the unit value for a given header.

Source

pub fn decode_unit_value_of(&mut self, header: UnitHeader) -> Result<UnitValue>

Decodes unit value for a given header, as a UnitValue.

Source§

impl<R> Decoder<R>

Source

pub fn from_reader(reader: R) -> Self

Creates a decoder from a reader.

Source

pub fn into_reader(self) -> R

Returns the decoder’s internal reader, consuming self.

Source

pub fn pos(&self) -> usize

Returns the decoder’s current read position.

Source§

impl<'de, R> Decoder<R>
where R: Read<'de>,

Source

pub fn decode_value(&mut self) -> Result<Value>

Decodes a Value.

Source

pub fn peek_marker(&mut self) -> Result<Marker>

Decodes a value’s type Marker.

Source

pub fn decode_header(&mut self) -> Result<Header>

Decodes a value’s Header.

Source

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

Skips the next to-be-decoded value.

Source

pub fn skip_value_of(&mut self, header: Header) -> Result<()>

Skips the value for a given header.

Source

pub fn decode_value_of(&mut self, header: Header) -> Result<Value>

Decodes value for a given header.

Trait Implementations§

Source§

impl<R: Debug> Debug for Decoder<R>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Decoder<R>
where R: Freeze,

§

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

§

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

§

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

§

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

§

impl<R> UnwindSafe for Decoder<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.