Skip to main content

PacketReader

Struct PacketReader 

Source
pub struct PacketReader<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> PacketReader<'a>

Source

pub fn new(buffer: &'a [u8], size: u16) -> Self

Source

pub fn position(&self) -> u16

Source

pub fn remaining(&self) -> u16

Source

pub fn can_read(&self, bytes: u16) -> bool

Source

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

Source

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

Source

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

Source

pub fn read_bytes(&mut self, dest: &mut [u8]) -> Result<()>

Source

pub fn skip(&mut self, count: u16) -> Result<()>

Source

pub fn peek_byte(&self) -> Result<u8>

Source

pub fn current_ptr(&self) -> &'a [u8]

Source

pub fn parse_coap_header(&mut self) -> Result<CoAPHeader>

Source

pub fn skip_token(&mut self, token_length: u8) -> Result<()>

Source

pub fn parse_coap_option(&mut self) -> Result<(u16, u16, &'a [u8])>

Parse a single CoAP option. Returns (delta, length, value_slice).

Source

pub fn parse_signet_options(&mut self) -> Result<SigNetOptions>

Parse all 6 SigNet options (2076–2236) from the current position. Stops at the payload marker (0xFF) — all options including HMAC must precede it. Leaves the reader positioned at the first byte of the payload.

Source

pub fn parse_tlv_block(&mut self) -> Result<TLVBlock<'a>>

Source

pub fn extract_uri_string(&mut self, uri_string: &mut [u8]) -> Result<usize>

Auto Trait Implementations§

§

impl<'a> Freeze for PacketReader<'a>

§

impl<'a> RefUnwindSafe for PacketReader<'a>

§

impl<'a> Send for PacketReader<'a>

§

impl<'a> Sync for PacketReader<'a>

§

impl<'a> Unpin for PacketReader<'a>

§

impl<'a> UnsafeUnpin for PacketReader<'a>

§

impl<'a> UnwindSafe for PacketReader<'a>

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

Source§

type Output = T

Should always be Self
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.