Struct time::UtcOffset [−][src]
pub struct UtcOffset { /* fields omitted */ }
Expand description
An offset from UTC.
Guaranteed to store values up to ±23:59:59. Any values outside this range may have incidental support that can change at any time without notice. If you need support outside this range, please file an issue with your use case.
Implementations
impl UtcOffset
[src]
impl UtcOffset
[src]pub const fn east_hours(hours: u8) -> Self
[src]
pub const fn east_hours(hours: u8) -> Self
[src]Create a UtcOffset
representing an easterly offset by the number of
hours provided.
assert_eq!(UtcOffset::east_hours(1).as_hours(), 1); assert_eq!(UtcOffset::east_hours(2).as_minutes(), 120);
pub const fn west_hours(hours: u8) -> Self
[src]
pub const fn west_hours(hours: u8) -> Self
[src]Create a UtcOffset
representing a westerly offset by the number of
hours provided.
assert_eq!(UtcOffset::west_hours(1).as_hours(), -1); assert_eq!(UtcOffset::west_hours(2).as_minutes(), -120);
pub const fn hours(hours: i8) -> Self
[src]
pub const fn hours(hours: i8) -> Self
[src]Create a UtcOffset
representing an offset by the number of hours
provided.
assert_eq!(UtcOffset::hours(2).as_minutes(), 120); assert_eq!(UtcOffset::hours(-2).as_minutes(), -120);
pub const fn east_minutes(minutes: u16) -> Self
[src]
pub const fn east_minutes(minutes: u16) -> Self
[src]Create a UtcOffset
representing an easterly offset by the number of
minutes provided.
assert_eq!(UtcOffset::east_minutes(60).as_hours(), 1);
pub const fn west_minutes(minutes: u16) -> Self
[src]
pub const fn west_minutes(minutes: u16) -> Self
[src]Create a UtcOffset
representing a westerly offset by the number of
minutes provided.
assert_eq!(UtcOffset::west_minutes(60).as_hours(), -1);
pub const fn minutes(minutes: i16) -> Self
[src]
pub const fn minutes(minutes: i16) -> Self
[src]Create a UtcOffset
representing a offset by the number of minutes
provided.
assert_eq!(UtcOffset::minutes(60).as_hours(), 1); assert_eq!(UtcOffset::minutes(-60).as_hours(), -1);
pub const fn east_seconds(seconds: u32) -> Self
[src]
pub const fn east_seconds(seconds: u32) -> Self
[src]Create a UtcOffset
representing an easterly offset by the number of
seconds provided.
assert_eq!(UtcOffset::east_seconds(3_600).as_hours(), 1); assert_eq!(UtcOffset::east_seconds(1_800).as_minutes(), 30);
pub const fn west_seconds(seconds: u32) -> Self
[src]
pub const fn west_seconds(seconds: u32) -> Self
[src]Create a UtcOffset
representing a westerly offset by the number of
seconds provided.
assert_eq!(UtcOffset::west_seconds(3_600).as_hours(), -1); assert_eq!(UtcOffset::west_seconds(1_800).as_minutes(), -30);
pub const fn seconds(seconds: i32) -> Self
[src]
pub const fn seconds(seconds: i32) -> Self
[src]Create a UtcOffset
representing an offset by the number of seconds
provided.
assert_eq!(UtcOffset::seconds(3_600).as_hours(), 1); assert_eq!(UtcOffset::seconds(-3_600).as_hours(), -1);
pub const fn as_seconds(self) -> i32
[src]
pub const fn as_seconds(self) -> i32
[src]Get the number of seconds from UTC the value is. Positive is east, negative is west.
assert_eq!(UtcOffset::UTC.as_seconds(), 0); assert_eq!(UtcOffset::hours(12).as_seconds(), 43_200); assert_eq!(UtcOffset::hours(-12).as_seconds(), -43_200);
pub const fn as_minutes(self) -> i16
[src]
pub const fn as_minutes(self) -> i16
[src]Get the number of minutes from UTC the value is. Positive is east, negative is west.
assert_eq!(UtcOffset::UTC.as_minutes(), 0); assert_eq!(UtcOffset::hours(12).as_minutes(), 720); assert_eq!(UtcOffset::hours(-12).as_minutes(), -720);
impl UtcOffset
[src]
impl UtcOffset
[src]Methods that allow parsing and formatting the UtcOffset
.
Trait Implementations
impl Ord for UtcOffset
[src]
impl Ord for UtcOffset
[src]impl PartialOrd<UtcOffset> for UtcOffset
[src]
impl PartialOrd<UtcOffset> for UtcOffset
[src]fn partial_cmp(&self, other: &UtcOffset) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &UtcOffset) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for UtcOffset
[src]
impl Eq for UtcOffset
[src]
impl StructuralEq for UtcOffset
[src]
impl StructuralPartialEq for UtcOffset
[src]
Auto Trait Implementations
impl RefUnwindSafe for UtcOffset
impl Send for UtcOffset
impl Sync for UtcOffset
impl Unpin for UtcOffset
impl UnwindSafe for UtcOffset
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more