Skip to main content

FastDecoder

Struct FastDecoder 

Source
pub struct FastDecoder { /* private fields */ }
Expand description

FAST protocol decoder.

Implementations§

Source§

impl FastDecoder

Source

pub fn new() -> FastDecoder

Creates a new FAST decoder.

Source

pub fn reset(&mut self)

Resets the decoder state.

Source

pub fn decode_uint(data: &[u8], offset: &mut usize) -> Result<u64, FastError>

Decodes an unsigned integer using stop-bit encoding.

§Arguments
  • data - The input bytes
  • offset - Current position (will be updated)
§Returns

The decoded unsigned integer.

§Errors

Returns FastError::UnexpectedEof if data is incomplete.

Source

pub fn decode_int(data: &[u8], offset: &mut usize) -> Result<i64, FastError>

Decodes a signed integer using stop-bit encoding.

§Arguments
  • data - The input bytes
  • offset - Current position (will be updated)
§Returns

The decoded signed integer.

§Errors

Returns FastError::UnexpectedEof if data is incomplete.

Source

pub fn decode_ascii( data: &[u8], offset: &mut usize, ) -> Result<String, FastError>

Decodes an ASCII string using stop-bit encoding.

§Arguments
  • data - The input bytes
  • offset - Current position (will be updated)
§Returns

The decoded string.

§Errors

Returns FastError::UnexpectedEof if data is incomplete.

Source

pub fn decode_bytes( data: &[u8], offset: &mut usize, ) -> Result<Vec<u8>, FastError>

Decodes a byte vector.

§Arguments
  • data - The input bytes
  • offset - Current position (will be updated)
§Returns

The decoded bytes.

§Errors

Returns FastError::UnexpectedEof if data is incomplete.

Source

pub fn decode_pmap( data: &[u8], offset: &mut usize, ) -> Result<PresenceMap, FastError>

Decodes a presence map.

§Arguments
  • data - The input bytes
  • offset - Current position (will be updated)
§Returns

The decoded presence map.

§Errors

Returns FastError::UnexpectedEof if data is incomplete.

Source

pub fn get_global(&self, key: &str) -> Option<&DictionaryValue>

Gets a value from the global dictionary.

Source

pub fn set_global(&mut self, key: impl Into<String>, value: DictionaryValue)

Sets a value in the global dictionary.

Source

pub fn get_template( &self, template_id: u32, key: &str, ) -> Option<&DictionaryValue>

Gets a value from a template dictionary.

Source

pub fn set_template( &mut self, template_id: u32, key: impl Into<String>, value: DictionaryValue, )

Sets a value in a template dictionary.

Source

pub const fn last_template_id(&self) -> Option<u32>

Returns the last used template ID.

Source

pub fn set_last_template_id(&mut self, id: u32)

Sets the last used template ID.

Trait Implementations§

Source§

impl Debug for FastDecoder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for FastDecoder

Source§

fn default() -> FastDecoder

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

Auto Trait Implementations§

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.