Skip to main content

Duration

Struct Duration 

Source
pub struct Duration(pub Duration);

Tuple Fields§

§0: Duration

Implementations§

Source§

impl Duration

Source

pub fn walk_revisioned_field_names( wire_revision: u16, ) -> &'static [&'static str]

Field names at the given wire revision in declaration order. Returns an empty slice if the revision is unknown. Generated by the revisioned derive.

Source§

impl Duration

Source

pub const REVISION: u16 = 1u16

The revision number of this type, as declared via #[revisioned(revision = N)].

Source§

impl Duration

Source

pub const MAX: Duration

Source

pub const ZERO: Duration

Source§

impl Duration

Source

pub fn new(secs: u64, nanos: u32) -> Duration

Create a duration from both seconds and nanoseconds components

Source

pub fn nanos(&self) -> u128

Get the total number of nanoseconds

Source

pub fn micros(&self) -> u128

Get the total number of microseconds

Source

pub fn millis(&self) -> u128

Get the total number of milliseconds

Source

pub fn secs(&self) -> u64

Get the total number of seconds

Source

pub fn mins(&self) -> u64

Get the total number of minutes

Source

pub fn hours(&self) -> u64

Get the total number of hours

Source

pub fn days(&self) -> u64

Get the total number of dats

Source

pub fn weeks(&self) -> u64

Get the total number of months

Source

pub fn years(&self) -> u64

Get the total number of years

Source

pub fn from_nanos(nanos: u64) -> Duration

Create a duration from nanoseconds

Source

pub fn from_micros(micros: u64) -> Duration

Create a duration from microseconds

Source

pub fn from_millis(millis: u64) -> Duration

Create a duration from milliseconds

Source

pub fn from_secs(secs: u64) -> Duration

Create a duration from seconds

Source

pub fn from_mins(mins: u64) -> Option<Duration>

Create a duration from minutes

Source

pub fn from_hours(hours: u64) -> Option<Duration>

Create a duration from hours

Source

pub fn from_days(days: u64) -> Option<Duration>

Create a duration from days

Source

pub fn from_weeks(weeks: u64) -> Option<Duration>

Create a duration from weeks

Methods from Deref<Target = Duration>§

1.53.0 · Source

pub fn is_zero(&self) -> bool

Returns true if this Duration spans no time.

§Examples
use std::time::Duration;

assert!(Duration::ZERO.is_zero());
assert!(Duration::new(0, 0).is_zero());
assert!(Duration::from_nanos(0).is_zero());
assert!(Duration::from_secs(0).is_zero());

assert!(!Duration::new(1, 1).is_zero());
assert!(!Duration::from_nanos(1).is_zero());
assert!(!Duration::from_secs(1).is_zero());
1.3.0 · Source

pub fn as_secs(&self) -> u64

Returns the number of whole seconds contained by this Duration.

The returned value does not include the fractional (nanosecond) part of the duration, which can be obtained using subsec_nanos.

§Examples
use std::time::Duration;

let duration = Duration::new(5, 730_023_852);
assert_eq!(duration.as_secs(), 5);

To determine the total number of seconds represented by the Duration including the fractional part, use as_secs_f64 or as_secs_f32

1.27.0 · Source

pub fn subsec_millis(&self) -> u32

Returns the fractional part of this Duration, in whole milliseconds.

This method does not return the length of the duration when represented by milliseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one thousand).

§Examples
use std::time::Duration;

let duration = Duration::from_millis(5_432);
assert_eq!(duration.as_secs(), 5);
assert_eq!(duration.subsec_millis(), 432);
1.27.0 · Source

pub fn subsec_micros(&self) -> u32

Returns the fractional part of this Duration, in whole microseconds.

This method does not return the length of the duration when represented by microseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one million).

§Examples
use std::time::Duration;

let duration = Duration::from_micros(1_234_567);
assert_eq!(duration.as_secs(), 1);
assert_eq!(duration.subsec_micros(), 234_567);
1.3.0 · Source

pub fn subsec_nanos(&self) -> u32

Returns the fractional part of this Duration, in nanoseconds.

This method does not return the length of the duration when represented by nanoseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one billion).

§Examples
use std::time::Duration;

let duration = Duration::from_millis(5_010);
assert_eq!(duration.as_secs(), 5);
assert_eq!(duration.subsec_nanos(), 10_000_000);
1.33.0 · Source

pub fn as_millis(&self) -> u128

Returns the total number of whole milliseconds contained by this Duration.

§Examples
use std::time::Duration;

let duration = Duration::new(5, 730_023_852);
assert_eq!(duration.as_millis(), 5_730);
1.33.0 · Source

pub fn as_micros(&self) -> u128

Returns the total number of whole microseconds contained by this Duration.

§Examples
use std::time::Duration;

let duration = Duration::new(5, 730_023_852);
assert_eq!(duration.as_micros(), 5_730_023);
1.33.0 · Source

pub fn as_nanos(&self) -> u128

Returns the total number of nanoseconds contained by this Duration.

§Examples
use std::time::Duration;

let duration = Duration::new(5, 730_023_852);
assert_eq!(duration.as_nanos(), 5_730_023_852);
1.81.0 · Source

pub fn abs_diff(self, other: Duration) -> Duration

Computes the absolute difference between self and other.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(100, 0).abs_diff(Duration::new(80, 0)), Duration::new(20, 0));
assert_eq!(Duration::new(100, 400_000_000).abs_diff(Duration::new(110, 0)), Duration::new(9, 600_000_000));
1.16.0 · Source

pub fn checked_add(self, rhs: Duration) -> Option<Duration>

Checked Duration addition. Computes self + other, returning None if overflow occurred.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(0, 0).checked_add(Duration::new(0, 1)), Some(Duration::new(0, 1)));
assert_eq!(Duration::new(1, 0).checked_add(Duration::new(u64::MAX, 0)), None);
1.53.0 · Source

pub fn saturating_add(self, rhs: Duration) -> Duration

Saturating Duration addition. Computes self + other, returning Duration::MAX if overflow occurred.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(0, 0).saturating_add(Duration::new(0, 1)), Duration::new(0, 1));
assert_eq!(Duration::new(1, 0).saturating_add(Duration::new(u64::MAX, 0)), Duration::MAX);
1.16.0 · Source

pub fn checked_sub(self, rhs: Duration) -> Option<Duration>

Checked Duration subtraction. Computes self - other, returning None if the result would be negative or if overflow occurred.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(0, 1).checked_sub(Duration::new(0, 0)), Some(Duration::new(0, 1)));
assert_eq!(Duration::new(0, 0).checked_sub(Duration::new(0, 1)), None);
1.53.0 · Source

pub fn saturating_sub(self, rhs: Duration) -> Duration

Saturating Duration subtraction. Computes self - other, returning Duration::ZERO if the result would be negative or if overflow occurred.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1));
assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO);
1.16.0 · Source

pub fn checked_mul(self, rhs: u32) -> Option<Duration>

Checked Duration multiplication. Computes self * other, returning None if overflow occurred.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(0, 500_000_001).checked_mul(2), Some(Duration::new(1, 2)));
assert_eq!(Duration::new(u64::MAX - 1, 0).checked_mul(2), None);
1.53.0 · Source

pub fn saturating_mul(self, rhs: u32) -> Duration

Saturating Duration multiplication. Computes self * other, returning Duration::MAX if overflow occurred.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2));
assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX);
1.16.0 · Source

pub fn checked_div(self, rhs: u32) -> Option<Duration>

Checked Duration division. Computes self / other, returning None if other == 0.

§Examples
use std::time::Duration;

assert_eq!(Duration::new(2, 0).checked_div(2), Some(Duration::new(1, 0)));
assert_eq!(Duration::new(1, 0).checked_div(2), Some(Duration::new(0, 500_000_000)));
assert_eq!(Duration::new(2, 0).checked_div(0), None);
1.38.0 · Source

pub fn as_secs_f64(&self) -> f64

Returns the number of seconds contained by this Duration as f64.

The returned value includes the fractional (nanosecond) part of the duration.

§Examples
use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
assert_eq!(dur.as_secs_f64(), 2.7);
1.38.0 · Source

pub fn as_secs_f32(&self) -> f32

Returns the number of seconds contained by this Duration as f32.

The returned value includes the fractional (nanosecond) part of the duration.

§Examples
use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
assert_eq!(dur.as_secs_f32(), 2.7);
Source

pub fn as_millis_f64(&self) -> f64

🔬This is a nightly-only experimental API. (duration_millis_float)

Returns the number of milliseconds contained by this Duration as f64.

The returned value includes the fractional (nanosecond) part of the duration.

§Examples
#![feature(duration_millis_float)]
use std::time::Duration;

let dur = Duration::new(2, 345_678_000);
assert_eq!(dur.as_millis_f64(), 2_345.678);
Source

pub fn as_millis_f32(&self) -> f32

🔬This is a nightly-only experimental API. (duration_millis_float)

Returns the number of milliseconds contained by this Duration as f32.

The returned value includes the fractional (nanosecond) part of the duration.

§Examples
#![feature(duration_millis_float)]
use std::time::Duration;

let dur = Duration::new(2, 345_678_000);
assert_eq!(dur.as_millis_f32(), 2_345.678);
1.38.0 · Source

pub fn mul_f64(self, rhs: f64) -> Duration

Multiplies Duration by f64.

§Panics

This method will panic if result is negative, overflows Duration or not finite.

§Examples
use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000));
assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0));

Note that f64 does not have enough bits (f64::MANTISSA_DIGITS) to represent the full range of possible Duration with nanosecond precision, so rounding may occur even for trivial operations like multiplying by 1.

use std::time::Duration;

// This is about 14.9 weeks, remaining precise to the nanosecond:
let weeks = Duration::from_nanos(f64::MAX_EXACT_INTEGER as u64);
assert_eq!(weeks, weeks.mul_f64(1.0));

// A larger value incurs rounding in the floating-point operation:
let weeks = Duration::from_nanos(u64::MAX);
assert_ne!(weeks, weeks.mul_f64(1.0));

// This is over 285 million years, remaining precise to the second:
let years = Duration::from_secs(f64::MAX_EXACT_INTEGER as u64);
assert_eq!(years, years.mul_f64(1.0));

// And again larger values incur rounding:
let years = Duration::from_secs(u64::MAX / 2);
assert_ne!(years, years.mul_f64(1.0));
ⓘ
// In the extreme, rounding can even overflow `Duration`, which panics.
let _ = Duration::from_secs(u64::MAX).mul_f64(1.0);
1.38.0 · Source

pub fn mul_f32(self, rhs: f32) -> Duration

Multiplies Duration by f32.

Since the significand of f32 is quite limited compared to the range of Duration – only about 16.8ms of exact nanosecond precision – this method currently forwards to mul_f64 for greater accuracy.

§Panics

This method will panic if result is negative, overflows Duration or not finite.

§Examples
use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
// Note that this `3.14_f32` argument already has more floating-point
// representation error than a direct `3.14_f64` would, so the result
// is slightly different from the ideal 8.478s.
assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_283));
assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 0));
1.38.0 · Source

pub fn div_f64(self, rhs: f64) -> Duration

Divides Duration by f64.

§Panics

This method will panic if result is negative, overflows Duration or not finite.

§Examples
use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611));
assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_599));

Note that f64 does not have enough bits (f64::MANTISSA_DIGITS) to represent the full range of possible Duration with nanosecond precision, so rounding may occur even for trivial operations like dividing by 1.

use std::time::Duration;

// This is about 14.9 weeks, remaining precise to the nanosecond:
let weeks = Duration::from_nanos(f64::MAX_EXACT_INTEGER as u64);
assert_eq!(weeks, weeks.div_f64(1.0));

// A larger value incurs rounding in the floating-point operation:
let weeks = Duration::from_nanos(u64::MAX);
assert_ne!(weeks, weeks.div_f64(1.0));

// This is over 285 million years, remaining precise to the second:
let years = Duration::from_secs(f64::MAX_EXACT_INTEGER as u64);
assert_eq!(years, years.div_f64(1.0));

// And again larger values incur rounding:
let years = Duration::from_secs(u64::MAX / 2);
assert_ne!(years, years.div_f64(1.0));
ⓘ
// In the extreme, rounding can even overflow `Duration`, which panics.
let _ = Duration::from_secs(u64::MAX).div_f64(1.0);
1.38.0 · Source

pub fn div_f32(self, rhs: f32) -> Duration

Divides Duration by f32.

Since the significand of f32 is quite limited compared to the range of Duration – only about 16.8ms of exact nanosecond precision – this method currently forwards to div_f64 for greater accuracy.

§Panics

This method will panic if result is negative, overflows Duration or not finite.

§Examples
use std::time::Duration;

let dur = Duration::new(2, 700_000_000);
// Note that this `3.14_f32` argument already has more floating-point
// representation error than a direct `3.14_f64` would, so the result
// is slightly different from the ideally rounded 0.859_872_611.
assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_583));
assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_599));
1.80.0 · Source

pub fn div_duration_f64(self, rhs: Duration) -> f64

Divides Duration by Duration and returns f64.

§Examples
use std::time::Duration;

let dur1 = Duration::new(2, 700_000_000);
let dur2 = Duration::new(5, 400_000_000);
assert_eq!(dur1.div_duration_f64(dur2), 0.5);
1.80.0 · Source

pub fn div_duration_f32(self, rhs: Duration) -> f32

Divides Duration by Duration and returns f32.

§Examples
use std::time::Duration;

let dur1 = Duration::new(2, 700_000_000);
let dur2 = Duration::new(5, 400_000_000);
assert_eq!(dur1.div_duration_f32(dur2), 0.5);
Source

pub fn div_duration_floor(self, rhs: Duration) -> u128

🔬This is a nightly-only experimental API. (duration_integer_division)

Divides Duration by Duration and returns u128, rounding the result towards zero.

§Examples
#![feature(duration_integer_division)]
use std::time::Duration;

let dur = Duration::new(2, 0);
assert_eq!(dur.div_duration_floor(Duration::new(1, 000_000_001)), 1);
assert_eq!(dur.div_duration_floor(Duration::new(1, 000_000_000)), 2);
assert_eq!(dur.div_duration_floor(Duration::new(0, 999_999_999)), 2);
Source

pub fn div_duration_ceil(self, rhs: Duration) -> u128

🔬This is a nightly-only experimental API. (duration_integer_division)

Divides Duration by Duration and returns u128, rounding the result towards positive infinity.

§Examples
#![feature(duration_integer_division)]
use std::time::Duration;

let dur = Duration::new(2, 0);
assert_eq!(dur.div_duration_ceil(Duration::new(1, 000_000_001)), 2);
assert_eq!(dur.div_duration_ceil(Duration::new(1, 000_000_000)), 2);
assert_eq!(dur.div_duration_ceil(Duration::new(0, 999_999_999)), 3);

Trait Implementations§

Source§

impl Add for Duration

Source§

type Output = Duration

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<'b> Add<&'b Duration> for &Duration

Source§

type Output = Duration

The resulting type after applying the + operator.
Source§

fn add(self, other: &'b Duration) -> Duration

Performs the + operation. Read more
Source§

impl Add<Datetime> for Duration

Source§

type Output = Datetime

The resulting type after applying the + operator.
Source§

fn add(self, other: Datetime) -> Datetime

Performs the + operation. Read more
Source§

impl<'de> BorrowDecode<'de, IndexFormat> for Duration

Source§

impl<'de> BorrowDecode<'de> for Duration

Source§

impl Cast for Duration

Source§

fn can_cast(v: &Value) -> bool

Returns true if calling cast on the value will succeed. Read more
Source§

fn cast(v: Value) -> Result<Self, CastError>

Cast a value to the self type.
Source§

impl Clone for Duration

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Coerce for Duration

Source§

fn can_coerce(v: &Value) -> bool

Returns if calling coerce on the value will succeed or not. Read more
Source§

fn coerce(v: Value) -> Result<Self, CoerceError>

Coerce a value.
Source§

impl Copy for Duration

Source§

impl Debug for Duration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Duration

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for Duration

Source§

type Target = Duration

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DeserializeRevisioned for Duration

Source§

fn deserialize_revisioned<R: Read>(reader: &mut R) -> Result<Self, Error>

Deserializes a new instance of the struct from the specified reader.
Source§

impl Display for Duration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Encode for Duration

Source§

fn encode<W: Write>(&self, _w: &mut Writer<W>) -> Result<(), EncodeError>

Source§

impl Encode<IndexFormat> for Duration

Source§

fn encode<W: Write>(&self, _w: &mut Writer<W>) -> Result<(), EncodeError>

Source§

impl Eq for Duration

Source§

impl From<Duration> for Duration

Source§

fn from(v: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for Duration

Source§

fn from(s: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for PublicDuration

Source§

fn from(value: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for Duration

Source§

fn from(value: PublicDuration) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for Value

Source§

fn from(v: Duration) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Duration

Source§

type Err = ()

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl HasKind for Duration

Source§

impl Hash for Duration

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl InfoStructure for Duration

Source§

impl Ord for Duration

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Duration

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Duration

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Revisioned for Duration

Source§

fn revision() -> u16

Returns the current revision of this type.
Source§

fn type_id() -> TypeId
where Self: 'static,

Returns the type id of this type.
Source§

impl SerializeRevisioned for Duration

Source§

fn serialize_revisioned<W: Write>(&self, writer: &mut W) -> Result<(), Error>

Serializes the struct using the specified writer.
Source§

impl SkipCheckRevisioned for Duration

Source§

impl SkipRevisioned for Duration

Source§

fn skip_revisioned<R: Read>(reader: &mut R) -> Result<(), Error>

Source§

fn skip_revisioned_slice(reader: &mut SliceReader<'_>) -> Result<(), Error>

Consume through bytes backed by SliceReader without allocating a buffer for bulk segments. Read more
Source§

impl StructuralPartialEq for Duration

Source§

impl Sub for Duration

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
Source§

impl<'b> Sub<&'b Duration> for &Duration

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'b Duration) -> Duration

Performs the - operation. Read more
Source§

impl Sub<Datetime> for Duration

Source§

type Output = Datetime

The resulting type after applying the - operator.
Source§

fn sub(self, other: Datetime) -> Datetime

Performs the - operation. Read more
Source§

impl Sum for Duration

Source§

fn sum<I>(iter: I) -> Duration
where I: Iterator<Item = Self>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<'a> Sum<&'a Duration> for Duration

Source§

fn sum<I>(iter: I) -> Duration
where I: Iterator<Item = &'a Self>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl ToSql for Duration

Source§

fn fmt_sql(&self, f: &mut String, sql_fmt: SqlFormat)

Format the type to a SQL string.
Source§

fn to_sql(&self) -> String

Convert the type to a SQL string.
Source§

fn to_sql_pretty(&self) -> String

Convert the type to a pretty-printed SQL string with indentation.
Source§

impl TryAdd for Duration

Source§

type Output = Duration

Source§

fn try_add(self, other: Self) -> Result<Self>

Source§

impl<'b> TryAdd<&'b Duration> for &Duration

Source§

impl TryAdd<Datetime> for Duration

Source§

impl TrySub for Duration

Source§

type Output = Duration

Source§

fn try_sub(self, other: Self) -> Result<Self>

Source§

impl<'b> TrySub<&'b Duration> for &Duration

Source§

impl TrySub<Datetime> for Duration

Source§

impl WalkRevisioned for Duration

Source§

type Walker<'r, R: BorrowedReader + 'r> = DurationWalker<'r, R>

Walker produced by walk_revisioned. Read more
Source§

fn walk_revisioned<'r, R: BorrowedReader>( reader: &'r mut R, ) -> Result<Self::Walker<'r, R>, Error>

Read the type’s revision-level prefix and return a walker positioned at the start of the body. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SetEntry<T> for T
where T: Hash + Eq,

Source§

fn into_owned(self) -> T

Source§

fn equal(&self, other: &T) -> bool

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool