[][src]Struct xaynet::message::Sum2Buffer

pub struct Sum2Buffer<T> { /* fields omitted */ }

A wrapper around a buffer that contains a Sum2 message.

It provides getters and setters to access the different fields of the message safely.

Implementations

impl<T: AsRef<[u8]>> Sum2Buffer<T>[src]

pub fn new(bytes: T) -> Result<Self, DecodeError>[src]

Performs bound checks for the various message fields on bytes and returns a new Sum2Buffer.

Errors

Fails if the bytes are smaller than a minimal-sized sum2 message buffer.

pub fn new_unchecked(bytes: T) -> Self[src]

Returns a Sum2Buffer with the given bytes without performing bound checks.

This means that accessing the message fields may panic.

pub fn check_buffer_length(&self) -> Result<(), DecodeError>[src]

Performs bound checks for the various message fields on this buffer.

impl<T: AsMut<[u8]>> Sum2Buffer<T>[src]

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

Gets a mutable reference to the sum signature field.

Panics

Accessing the field may panic if the buffer has not been checked before.

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

Gets a mutable reference to the mask field.

Panics

Accessing the field may panic if the buffer has not been checked before.

impl<'a, T: AsRef<[u8]> + ?Sized> Sum2Buffer<&'a T>[src]

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

Gets a reference to the sum signature field.

Panics

Accessing the field may panic if the buffer has not been checked before.

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

Gets a reference to the mask field.

Panics

Accessing the field may panic if the buffer has not been checked before.

Trait Implementations

impl<T: Clone> Clone for Sum2Buffer<T>[src]

impl<T: Debug> Debug for Sum2Buffer<T>[src]

impl<T: Eq> Eq for Sum2Buffer<T>[src]

impl<T: Hash> Hash for Sum2Buffer<T>[src]

impl<T: PartialEq> PartialEq<Sum2Buffer<T>> for Sum2Buffer<T>[src]

impl<T> StructuralEq for Sum2Buffer<T>[src]

impl<T> StructuralPartialEq for Sum2Buffer<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Sum2Buffer<T> where
    T: RefUnwindSafe

impl<T> Send for Sum2Buffer<T> where
    T: Send

impl<T> Sync for Sum2Buffer<T> where
    T: Sync

impl<T> Unpin for Sum2Buffer<T> where
    T: Unpin

impl<T> UnwindSafe for Sum2Buffer<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]