pub struct TzTime { /* private fields */ }
Expand description
Timezone-aware intra-day timestamp.
§Examples
use hotfix_encoding::field_access::FieldType;
use hotfix_encoding::field_types::{Tz, TzTime};
let tztime = TzTime::deserialize(b"07:39:20Z").unwrap();
assert_eq!(tztime.hour(), 7);
assert_eq!(tztime.minute(), 39);
assert_eq!(tztime.second(), 20);
assert_eq!(tztime.timezone(), Tz::UTC);
Implementations§
Source§impl TzTime
impl TzTime
Sourcepub fn hour(&self) -> u32
pub fn hour(&self) -> u32
Returns the hour of self
.
§Examples
use hotfix_encoding::field_access::FieldType;
use hotfix_encoding::field_types::TzTime;
let dtf = TzTime::deserialize(b"12:45:00Z").unwrap();
assert_eq!(dtf.minute(), 45);
Sourcepub fn minute(&self) -> u32
pub fn minute(&self) -> u32
Returns the minutes’ portion of self
. This goes from 0 to 59
(including), but can go up to 60 for leap seconds.
Trait Implementations§
Source§impl<'a> FieldType<'a> for TzTime
impl<'a> FieldType<'a> for TzTime
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 moreimpl Copy for TzTime
impl Eq for TzTime
impl StructuralPartialEq for TzTime
Auto Trait Implementations§
impl Freeze for TzTime
impl RefUnwindSafe for TzTime
impl Send for TzTime
impl Sync for TzTime
impl Unpin for TzTime
impl UnwindSafe for TzTime
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