pub struct Stratum(pub u8);Expand description
An 8-bit integer representing the stratum.
ⓘ
+--------+-----------------------------------------------------+
| Value | Meaning |
+--------+-----------------------------------------------------+
| 0 | unspecified or invalid |
| 1 | primary server (e.g., equipped with a GPS receiver) |
| 2-15 | secondary server (via NTP) |
| 16 | unsynchronized |
| 17-255 | reserved |
+--------+-----------------------------------------------------+It is customary to map the stratum value 0 in received packets to MAXSTRAT in the peer
variable p.stratum and to map p.stratum values of MAXSTRAT or greater to 0 in transmitted
packets. This allows reference clocks, which normally appear at stratum 0, to be conveniently
mitigated using the same clock selection algorithms used for external sources.
Tuple Fields§
§0: u8Implementations§
Source§impl Stratum
impl Stratum
Sourcepub const UNSPECIFIED: Self
pub const UNSPECIFIED: Self
Unspecified or invalid.
Sourcepub const SECONDARY_MIN: Self
pub const SECONDARY_MIN: Self
The minimum value specifying a secondary server (via NTP).
Sourcepub const SECONDARY_MAX: Self
pub const SECONDARY_MAX: Self
The maximum value specifying a secondary server (via NTP).
Sourcepub const UNSYNCHRONIZED: Self
pub const UNSYNCHRONIZED: Self
An unsynchronized stratum.
Sourcepub fn is_secondary(&self) -> bool
pub fn is_secondary(&self) -> bool
Whether or not the stratum represents a secondary server.
Sourcepub fn is_reserved(&self) -> bool
pub fn is_reserved(&self) -> bool
Whether or not the stratum is in the reserved range.
Trait Implementations§
Source§impl ConstPackedSizeBytes for Stratum
impl ConstPackedSizeBytes for Stratum
Source§const PACKED_SIZE_BYTES: usize = 1
const PACKED_SIZE_BYTES: usize = 1
The constant size in bytes when this type is packed for network transmission.
Source§impl FromBytes for Stratum
impl FromBytes for Stratum
Source§fn from_bytes(buf: &[u8]) -> Result<(Self, usize), ParseError>
fn from_bytes(buf: &[u8]) -> Result<(Self, usize), ParseError>
Parse from the given byte slice. Returns the parsed value and the
number of bytes consumed from the front of
buf.Source§impl Ord for Stratum
impl Ord for Stratum
Source§impl PartialOrd for Stratum
impl PartialOrd for Stratum
Source§impl ReadFromBytes for Stratum
Available on crate feature std only.
impl ReadFromBytes for Stratum
Available on crate feature
std only.Source§fn read_from_bytes<R: ReadBytesExt>(reader: R) -> Result<Self>
fn read_from_bytes<R: ReadBytesExt>(reader: R) -> Result<Self>
Read the command from bytes.
Source§impl ToBytes for Stratum
impl ToBytes for Stratum
Source§fn to_bytes(&self, buf: &mut [u8]) -> Result<usize, ParseError>
fn to_bytes(&self, buf: &mut [u8]) -> Result<usize, ParseError>
Write this value into the given byte slice. Returns the number of bytes
written. Fails with
ParseError::BufferTooShort if buf is too short.Source§impl WriteToBytes for Stratum
Available on crate feature std only.
impl WriteToBytes for Stratum
Available on crate feature
std only.Source§fn write_to_bytes<W: WriteBytesExt>(&self, writer: W) -> Result<()>
fn write_to_bytes<W: WriteBytesExt>(&self, writer: W) -> Result<()>
Write the command to bytes.
impl Copy for Stratum
impl Eq for Stratum
impl StructuralPartialEq for Stratum
Auto Trait Implementations§
impl Freeze for Stratum
impl RefUnwindSafe for Stratum
impl Send for Stratum
impl Sync for Stratum
impl Unpin for Stratum
impl UnsafeUnpin for Stratum
impl UnwindSafe for Stratum
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