Struct icu::calendar::types::NanoSecond
source · pub struct NanoSecond(_);
Expand description
A fractional second component, stored as nanoseconds.
Must be within inclusive bounds [0, 999_999_999]
.
Implementations§
source§impl NanoSecond
impl NanoSecond
source§impl NanoSecond
impl NanoSecond
sourcepub fn try_add(self, other: u32) -> Option<NanoSecond>
pub fn try_add(self, other: u32) -> Option<NanoSecond>
Attempts to add two values.
Returns Some
if the sum is within bounds.
Returns None
if the sum is out of bounds.
sourcepub fn try_sub(self, other: u32) -> Option<NanoSecond>
pub fn try_sub(self, other: u32) -> Option<NanoSecond>
Attempts to subtract two values.
Returns Some
if the difference is within bounds.
Returns None
if the difference is out of bounds.
Trait Implementations§
source§impl Clone for NanoSecond
impl Clone for NanoSecond
source§fn clone(&self) -> NanoSecond
fn clone(&self) -> NanoSecond
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 NanoSecond
impl Debug for NanoSecond
source§impl Default for NanoSecond
impl Default for NanoSecond
source§fn default() -> NanoSecond
fn default() -> NanoSecond
Returns the “default value” for a type. Read more
source§impl FromStr for NanoSecond
impl FromStr for NanoSecond
§type Err = CalendarError
type Err = CalendarError
The associated error which can be returned from parsing.
source§fn from_str(input: &str) -> Result<NanoSecond, <NanoSecond as FromStr>::Err>
fn from_str(input: &str) -> Result<NanoSecond, <NanoSecond as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moresource§impl Hash for NanoSecond
impl Hash for NanoSecond
source§impl Ord for NanoSecond
impl Ord for NanoSecond
source§fn cmp(&self, other: &NanoSecond) -> Ordering
fn cmp(&self, other: &NanoSecond) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<NanoSecond> for NanoSecond
impl PartialEq<NanoSecond> for NanoSecond
source§fn eq(&self, other: &NanoSecond) -> bool
fn eq(&self, other: &NanoSecond) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<NanoSecond> for NanoSecond
impl PartialOrd<NanoSecond> for NanoSecond
source§fn partial_cmp(&self, other: &NanoSecond) -> Option<Ordering>
fn partial_cmp(&self, other: &NanoSecond) -> Option<Ordering>
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 TryFrom<u32> for NanoSecond
impl TryFrom<u32> for NanoSecond
§type Error = CalendarError
type Error = CalendarError
The type returned in the event of a conversion error.
source§fn try_from(
input: u32
) -> Result<NanoSecond, <NanoSecond as TryFrom<u32>>::Error>
fn try_from( input: u32 ) -> Result<NanoSecond, <NanoSecond as TryFrom<u32>>::Error>
Performs the conversion.
source§impl TryFrom<usize> for NanoSecond
impl TryFrom<usize> for NanoSecond
§type Error = CalendarError
type Error = CalendarError
The type returned in the event of a conversion error.
source§fn try_from(
input: usize
) -> Result<NanoSecond, <NanoSecond as TryFrom<usize>>::Error>
fn try_from( input: usize ) -> Result<NanoSecond, <NanoSecond as TryFrom<usize>>::Error>
Performs the conversion.