[−][src]Struct ieee802154::mac::frame::header::ShortAddress
A 16-bit short address
Short address assigned to a device during association, used to identify the device in the PAN.
Example
use ieee802154::mac::ShortAddress; let short_address = ShortAddress(0x0123);
Implementations
impl ShortAddress
[src]
pub const BROADCAST: Self
[src]
An instance of ShortAddress
that represents the broadcast address.
pub fn broadcast() -> Self
[src]
Creates an instance of ShortAddress
that represents the broadcast address
pub fn decode(buf: &mut dyn Buf) -> Result<Self, DecodeError>
[src]
Decodes an address from a byte buffer
This method is used by Header::decode
to decode addresses. Unless
you decide to write your own code for decoding headers, there should be
no reason to call this method directly.
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::frame::{DecodeError, header::ShortAddress}; let mut bytes = &[0x56, 0x78][..]; let address = ShortAddress::decode(&mut bytes)?; assert_eq!(address, ShortAddress(0x7856));
pub fn encode(&self, buf: &mut dyn BufMut)
[src]
Encodes the address into a buffer
Example
use ieee802154::mac::ShortAddress; let address = ShortAddress(0x5678); let mut bytes = bytes::BytesMut::with_capacity(2); address.encode(&mut bytes); let expected_bytes = [0x78, 0x56]; assert_eq!(bytes[..], expected_bytes[..]);
Trait Implementations
impl Clone for ShortAddress
[src]
fn clone(&self) -> ShortAddress
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for ShortAddress
[src]
impl Debug for ShortAddress
[src]
impl Eq for ShortAddress
[src]
impl Hash for ShortAddress
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Hash for ShortAddress
[src]
fn hash<H: Hasher>(&self, _h: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
[src]
H: Hasher,
impl PartialEq<ShortAddress> for ShortAddress
[src]
fn eq(&self, other: &ShortAddress) -> bool
[src]
fn ne(&self, other: &ShortAddress) -> bool
[src]
impl StructuralEq for ShortAddress
[src]
impl StructuralPartialEq for ShortAddress
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,