pub enum TimeOffset {
Z,
Custom {
minutes: i16,
},
}Expand description
A UTC offset attached to an offset date-time.
TOML offset date-times include a timezone offset suffix such as Z,
+05:30, or -08:00. This enum represents that offset.
§Examples
use toml_spanner::{DateTime, TimeOffset};
let dt: DateTime = "2026-01-04T12:00:00Z".parse().unwrap();
assert_eq!(dt.offset(), Some(TimeOffset::Z));
let dt: DateTime = "2026-01-04T12:00:00+05:30".parse().unwrap();
assert_eq!(dt.offset(), Some(TimeOffset::Custom { minutes: 330 }));
let dt: DateTime = "2026-01-04T12:00:00-08:00".parse().unwrap();
assert_eq!(dt.offset(), Some(TimeOffset::Custom { minutes: -480 }));Variants§
Trait Implementations§
Source§impl Clone for TimeOffset
impl Clone for TimeOffset
Source§fn clone(&self) -> TimeOffset
fn clone(&self) -> TimeOffset
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 Debug for TimeOffset
impl Debug for TimeOffset
Source§impl PartialEq for TimeOffset
impl PartialEq for TimeOffset
impl Copy for TimeOffset
impl Eq for TimeOffset
impl StructuralPartialEq for TimeOffset
Auto Trait Implementations§
impl Freeze for TimeOffset
impl RefUnwindSafe for TimeOffset
impl Send for TimeOffset
impl Sync for TimeOffset
impl Unpin for TimeOffset
impl UnsafeUnpin for TimeOffset
impl UnwindSafe for TimeOffset
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