[][src]Struct ieee802154::mac::frame::header::PanId

pub struct PanId(pub u16);

Personal Area Network Identifier

A 16-bit value that identifies a PAN

Example

use ieee802154::mac::PanId;

let pan_id = PanId(0x0123);

Implementations

impl PanId[src]

pub fn broadcast() -> Self[src]

Get the broadcast PAN identifier

pub fn decode(buf: &mut dyn Buf) -> Result<Self, DecodeError>[src]

Decodes an PAN identifier from a byte buffer

Errors

This function returns an error, if there are not enough bytes in the buffer to encode a valid Address instance.

Example

use ieee802154::mac::PanId;

let mut bytes = &[0x56, 0x78][..];
let address = PanId::decode(&mut bytes)?;

assert_eq!(address.0, 0x7856);

pub fn encode(&self, buf: &mut dyn BufMut)[src]

Encodes the PAN identifier into a buffer

Example

use ieee802154::mac::PanId;
use bytes::BytesMut;

let address = PanId(0x1234);

let mut bytes = BytesMut::with_capacity(2);
address.encode(&mut bytes);

let expected_bytes = [0x34, 0x12];
assert_eq!(bytes[..], expected_bytes[..]);

Trait Implementations

impl Clone for PanId[src]

impl Copy for PanId[src]

impl Debug for PanId[src]

impl Eq for PanId[src]

impl Hash for PanId[src]

impl Hash for PanId[src]

impl PartialEq<PanId> for PanId[src]

impl StructuralEq for PanId[src]

impl StructuralPartialEq for PanId[src]

Auto Trait Implementations

impl Send for PanId

impl Sync for PanId

impl Unpin for PanId

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<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.