pub struct ClockIdentity(pub [u8; 8]);Expand description
The identity of a PTP node.
All ptp clocks in a network need a unique clock identity. A common approach
is to use a mac address of the device to generate a unique identifier (see
from_mac_address).
For more details, see IEEE1588-2019 section 7.5.2.2.2.
Tuple Fields§
§0: [u8; 8]Implementations§
Source§impl ClockIdentity
impl ClockIdentity
Sourcepub fn from_mac_address(addr: [u8; 6]) -> Self
pub fn from_mac_address(addr: [u8; 6]) -> Self
Create a ClockIdentity from a mac address.
Fills the first six bytes with the mac address and the rest with zeroes.
§Example
let id = ClockIdentity::from_mac_address([0xA, 0xB, 0xC, 0xD, 0xE, 0xF]);
assert_eq!(id.0, [0xA, 0xB, 0xC, 0xD, 0xE, 0xF, 0x0, 0x0]);Trait Implementations§
Source§impl Clone for ClockIdentity
impl Clone for ClockIdentity
impl Copy for ClockIdentity
Source§impl Debug for ClockIdentity
impl Debug for ClockIdentity
Source§impl Default for ClockIdentity
impl Default for ClockIdentity
Source§impl<'de> Deserialize<'de> for ClockIdentity
impl<'de> Deserialize<'de> for ClockIdentity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ClockIdentity
Available on crate feature std only.
impl Display for ClockIdentity
Available on crate feature
std only.impl Eq for ClockIdentity
Source§impl Hash for ClockIdentity
impl Hash for ClockIdentity
Source§impl Ord for ClockIdentity
impl Ord for ClockIdentity
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ClockIdentity
impl PartialEq for ClockIdentity
Source§impl PartialOrd for ClockIdentity
impl PartialOrd for ClockIdentity
Source§impl Serialize for ClockIdentity
impl Serialize for ClockIdentity
impl StructuralPartialEq for ClockIdentity
Auto Trait Implementations§
impl Forget for ClockIdentity
impl Freeze for ClockIdentity
impl Move for ClockIdentity
impl RefUnwindSafe for ClockIdentity
impl Send for ClockIdentity
impl Sync for ClockIdentity
impl Unpin for ClockIdentity
impl UnsafeUnpin for ClockIdentity
impl UnwindSafe for ClockIdentity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more