#[repr(C)]pub struct ShortFormat {
pub seconds: u16,
pub fraction: u16,
}Expand description
NTP Short Format - Used in delay and dispersion header fields where the full resolution and range of the other formats are not justified. It includes a 16-bit unsigned seconds field and a 16-bit fraction field.
§Layout
ⓘ
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Seconds | Fraction |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Fields§
§seconds: u16Seconds component (16-bit unsigned).
fraction: u16Fractional seconds component (16-bit unsigned).
Trait Implementations§
Source§impl Clone for ShortFormat
impl Clone for ShortFormat
Source§fn clone(&self) -> ShortFormat
fn clone(&self) -> ShortFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConstPackedSizeBytes for ShortFormat
impl ConstPackedSizeBytes for ShortFormat
Source§const PACKED_SIZE_BYTES: usize = 4
const PACKED_SIZE_BYTES: usize = 4
The constant size in bytes when this type is packed for network transmission.
Source§impl Debug for ShortFormat
impl Debug for ShortFormat
Source§impl Default for ShortFormat
impl Default for ShortFormat
Source§fn default() -> ShortFormat
fn default() -> ShortFormat
Returns the “default value” for a type. Read more
Source§impl From<Instant> for ShortFormat
impl From<Instant> for ShortFormat
Source§impl From<ShortFormat> for Instant
impl From<ShortFormat> for Instant
Source§fn from(t: ShortFormat) -> Self
fn from(t: ShortFormat) -> Self
Converts to this type from the input type.
Source§impl FromBytes for ShortFormat
impl FromBytes for ShortFormat
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 Hash for ShortFormat
impl Hash for ShortFormat
Source§impl Ord for ShortFormat
impl Ord for ShortFormat
Source§fn cmp(&self, other: &ShortFormat) -> Ordering
fn cmp(&self, other: &ShortFormat) -> Ordering
1.21.0 · 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
Source§impl PartialEq for ShortFormat
impl PartialEq for ShortFormat
Source§impl PartialOrd for ShortFormat
impl PartialOrd for ShortFormat
Source§impl ReadFromBytes for ShortFormat
Available on crate feature std only.
impl ReadFromBytes for ShortFormat
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 ShortFormat
impl ToBytes for ShortFormat
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 ShortFormat
Available on crate feature std only.
impl WriteToBytes for ShortFormat
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 ShortFormat
impl Eq for ShortFormat
impl StructuralPartialEq for ShortFormat
Auto Trait Implementations§
impl Freeze for ShortFormat
impl RefUnwindSafe for ShortFormat
impl Send for ShortFormat
impl Sync for ShortFormat
impl Unpin for ShortFormat
impl UnsafeUnpin for ShortFormat
impl UnwindSafe for ShortFormat
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