[][src]Struct async_coap::BlockInfo

pub struct BlockInfo(pub u32);

Type for interpreting block1 and block2 option values.

Methods

impl BlockInfo[src]

pub const NUM_MAX: u32[src]

Maximum legal value for num.

pub const SZX_MAX: u8[src]

Maximum legal value for szx.

pub fn new(num: u32, m: bool, szx: u8) -> Option<BlockInfo>[src]

Constructs a new BlockInfo from the number, more flag, and size exponent.

pub fn num(&self) -> u32[src]

Block number value.

pub fn more_flag(&self) -> bool[src]

More flag value. If set, there are more blocks to follow.

pub fn szx(&self) -> u8[src]

Block size exponent field value.

pub fn offset(&self) -> usize[src]

The offset (in bytes) that this block starts at.

pub fn len(&self) -> usize[src]

The length of this block, in bytes.

pub fn is_max_block(&self) -> bool[src]

Determines if calling BlockInfo::next will yield the next block or not.

If this method returns true, calling BlockInfo::next will fail.

pub fn is_invalid(&self) -> bool[src]

Checks the validity of the contained value.

pub fn valid(self) -> Option<BlockInfo>[src]

Checks the contained value for validity and, if valid, returns it in an Option.

pub fn next(&self) -> Option<BlockInfo>[src]

Calculates what the next block will be, if any.

pub fn smaller(&self) -> Option<BlockInfo>[src]

Calculates a smaller block size that maintains this block's offset.

pub fn with_more_flag(&self) -> BlockInfo[src]

Returns this BlockInfo's value with the more flag set.

pub fn without_more_flag(&self) -> BlockInfo[src]

Returns this BlockInfo's value without the more flag set.

Trait Implementations

impl From<u32> for BlockInfo[src]

impl Ord for BlockInfo[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl PartialOrd<BlockInfo> for BlockInfo[src]

impl PartialEq<BlockInfo> for BlockInfo[src]

impl Default for BlockInfo[src]

fn default() -> Self[src]

Returns a block info with an offset of zero and a block size of 1024.

impl Clone for BlockInfo[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Eq for BlockInfo[src]

impl Copy for BlockInfo[src]

impl Display for BlockInfo[src]

impl Debug for BlockInfo[src]

impl Hash for BlockInfo[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,