pub struct Time { /* private fields */ }
Expand description
Canonical data field (DTF) for
FixDatatype::UtcTimeOnly
.
Implementations§
Source§impl Time
impl Time
Sourcepub fn from_hmsm(
hour: u32,
minute: u32,
second: u32,
milli: u32,
) -> Option<Self>
pub fn from_hmsm( hour: u32, minute: u32, second: u32, milli: u32, ) -> Option<Self>
Creates a new time value from its components, with milliseconds.
Sourcepub const fn hour(&self) -> u32
pub const fn hour(&self) -> u32
Returns the hour of self
.
§Examples
use hotfix_encoding::field_access::FieldType;
use hotfix_encoding::field_types::Time;
let dtf = Time::deserialize(b"12:45:00").unwrap();
assert_eq!(dtf.hour(), 12)
Sourcepub const fn minute(&self) -> u32
pub const fn minute(&self) -> u32
Returns the hour of self
.
§Examples
use hotfix_encoding::field_access::FieldType;
use hotfix_encoding::field_types::Time;
let dtf = Time::deserialize(b"12:45:00").unwrap();
assert_eq!(dtf.minute(), 45)
Sourcepub const fn second(&self) -> u32
pub const fn second(&self) -> u32
Returns the second of self
.
§Examples
use hotfix_encoding::field_access::FieldType;
use hotfix_encoding::field_types::Time;
let dtf = Time::deserialize(b"12:45:00").unwrap();
assert_eq!(dtf.minute(), 45)
Leap second:
use hotfix_encoding::field_access::FieldType;
use hotfix_encoding::field_types::Time;
let dtf = Time::deserialize(b"23:59:60").unwrap();
assert_eq!(dtf.second(), 60)
Trait Implementations§
Source§impl<'a> FieldType<'a> for Time
impl<'a> FieldType<'a> for Time
Source§type SerializeSettings = ()
type SerializeSettings = ()
A type with values that customize the serialization algorithm, e.g.
padding information.
Source§fn serialize_with<B>(&self, buffer: &mut B, _settings: ()) -> usizewhere
B: Buffer,
fn serialize_with<B>(&self, buffer: &mut B, _settings: ()) -> usizewhere
B: Buffer,
Writes
self
to buffer
using custom serialization settings
.Source§fn deserialize(data: &'a [u8]) -> Result<Self, Self::Error>
fn deserialize(data: &'a [u8]) -> Result<Self, Self::Error>
Parses and deserializes from
data
.Source§fn serialize<B>(&self, buffer: &mut B) -> usizewhere
B: Buffer,
fn serialize<B>(&self, buffer: &mut B) -> usizewhere
B: Buffer,
Writes
self
to buffer
using default settings.Source§fn deserialize_lossy(data: &'a [u8]) -> Result<Self, Self::Error>
fn deserialize_lossy(data: &'a [u8]) -> Result<Self, Self::Error>
Like
FieldType::deserialize
, but it’s allowed to skip some amount of
input checking. Invalid inputs might not trigger errors and instead be
deserialized as random values. Read moreSource§impl Ord for Time
impl Ord for Time
Source§impl PartialOrd for Time
impl PartialOrd for Time
impl Copy for Time
impl Eq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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