pub struct Time {
pub seconds: i64,
pub offset: i32,
pub sign: Sign,
}Expand description
A timestamp with timezone.
Fields§
§seconds: i64time in seconds since epoch.
offset: i32time offset in seconds, may be negative to match the sign field.
sign: Signthe sign of offset, used to encode -0000 which would otherwise loose sign information.
Implementations§
source§impl Time
impl Time
Instantiation
source§impl Time
impl Time
Serialization with standard git format
sourcepub fn to_bstring(&self) -> BString
pub fn to_bstring(&self) -> BString
Serialize this instance into memory, similar to what write_to() would do with arbitrary Write implementations.
sourcepub fn write_to(&self, out: &mut dyn Write) -> Result<(), Error>
pub fn write_to(&self, out: &mut dyn Write) -> Result<(), Error>
Serialize this instance to out in a format suitable for use in header fields of serialized git commits or tags.
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Computes the number of bytes necessary to write it using Time::write_to().
Trait Implementations§
source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Time, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Time, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Time
impl Ord for Time
source§impl PartialEq for Time
impl PartialEq for Time
source§impl PartialOrd for Time
impl PartialOrd for Time
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl Serialize for Time
impl Serialize for Time
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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