pub struct TimeZoneOffset { /* private fields */ }
Expand description
A time-zone offset, with a signed number of hours and minutes.
§Examples
use whatwg_datetime::{parse_timezone_offset, TimeZoneOffset};
assert_eq!(parse_timezone_offset("-07:00"), TimeZoneOffset::new_opt(-7, 0));
Implementations§
Source§impl TimeZoneOffset
impl TimeZoneOffset
Sourcepub fn new_opt(hours: i32, minutes: i32) -> Option<Self>
pub fn new_opt(hours: i32, minutes: i32) -> Option<Self>
Creates a new TimeZoneOffset
from a signed number of hours and minutes.
This asserts that:
- hours are in between -23 and 23, inclusive,
- minutes are in between 0 and 59, inclusive
§Examples
use whatwg_datetime::TimeZoneOffset;
assert!(TimeZoneOffset::new_opt(-7, 0).is_some());
assert!(TimeZoneOffset::new_opt(23, 59).is_some());
assert!(TimeZoneOffset::new_opt(24, 0).is_none()); // Hours must be between [-23, 23]
assert!(TimeZoneOffset::new_opt(1, 60).is_none()); // Minutes must be between [0, 59]
Trait Implementations§
Source§impl Clone for TimeZoneOffset
impl Clone for TimeZoneOffset
Source§fn clone(&self) -> TimeZoneOffset
fn clone(&self) -> TimeZoneOffset
Returns a copy 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 TimeZoneOffset
impl Debug for TimeZoneOffset
Source§impl PartialEq for TimeZoneOffset
impl PartialEq for TimeZoneOffset
impl Copy for TimeZoneOffset
impl Eq for TimeZoneOffset
impl StructuralPartialEq for TimeZoneOffset
Auto Trait Implementations§
impl Freeze for TimeZoneOffset
impl RefUnwindSafe for TimeZoneOffset
impl Send for TimeZoneOffset
impl Sync for TimeZoneOffset
impl Unpin for TimeZoneOffset
impl UnwindSafe for TimeZoneOffset
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