openthread/ot/types/
extended_pan_id.rsuse crate::prelude_internal::*;
#[derive(Default, Copy, Clone)]
#[repr(transparent)]
pub struct ExtendedPanId(pub otExtendedPanId);
impl_ot_castable!(ExtendedPanId, otExtendedPanId);
impl std::fmt::Debug for ExtendedPanId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ExtendedPanId({})", hex::encode(self.as_slice()))
}
}
impl std::fmt::Display for ExtendedPanId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", hex::encode(self.as_slice()))
}
}
impl std::convert::From<[u8; 8]> for ExtendedPanId {
fn from(value: [u8; 8]) -> Self {
Self(otExtendedPanId { m8: value })
}
}
impl ExtendedPanId {
pub fn into_array(self) -> [u8; 8] {
self.0.m8
}
pub fn as_slice(&self) -> &[u8] {
&self.0.m8
}
pub fn to_vec(&self) -> Vec<u8> {
self.as_slice().to_vec()
}
}