Skip to main content

Time

Struct Time 

Source
pub struct Time<S: TimeScale> { /* private fields */ }
Expand description

A timestamp in time scale S, stored as nanoseconds since the epoch of the scale.

§Examples

use gnss_time::{Duration, Glonass, Gps, Time};

let t: Time<Gps> = Time::from_nanos(0); // GPS epoch
let later = t + Duration::from_seconds(3600);

assert_eq!((later - t).as_seconds(), 3600);

// Compile-time error — different time scales are incompatible:
// let glo: Time<Glonass> = Time::from_nanos(0);
// let _ = later - glo; // ← ERROR

Implementations§

Source§

impl<S: TimeScale> Time<S>

Source

pub const EPOCH: Self

The scale’s epoch — 0 nanoseconds.

Corresponds to the calendar date defined by TimeScale::EPOCH_CIVIL (e.g. 1980-01-06 for GPS, 1996-01-01 for GLONASS).

Source

pub const MIN: Self = Self::EPOCH

Минимальное представляемое значение (синоним EPOCH).

Source

pub const MAX: Self

Maximum representable instant.

u64::MAX nanoseconds ≈ 584.5 years past the scale’s epoch.

ScaleEpochMAX ≈ calendar date
GLONASS1996-01-012580-07-01
GPS1980-01-062564-07-04
Galileo1999-08-222584-02-15
BeiDou2006-01-012590-07-02
TAI1958-01-012542-07-05
UTC1972-01-012556-07-03

Arithmetic near MAX will overflow — use checked_add, saturating_add, or try_add.

Source

pub const NANOS_PER_YEAR: u64

Nanoseconds per non-leap year (365 days).

Useful for sanity-checking that a value is within a reasonable range:

use gnss_time::{scale::Gps, Time};

// 50 years from GPS epoch
let fifty_years = Time::<Gps>::from_nanos(50 * Time::<Gps>::NANOS_PER_YEAR);

assert!(fifty_years.as_nanos() > 0);
Source

pub const fn from_nanos(nanos: u64) -> Self

Construct from raw nanoseconds since this scale’s epoch.

Source

pub const fn from_seconds(secs: u64) -> Self

Construct from whole seconds since this scale’s epoch.

§Panics

Panics if secs * 1_000_000_000 overflows u64.

Source

pub const fn checked_from_seconds(secs: u64) -> Option<Self>

Construct from whole seconds, returning None on overflow.

Source§

impl<S: TimeScale> Time<S>

Source

pub const fn as_nanos(self) -> u64

Raw nanoseconds since this scale’s epoch.

Source

pub const fn as_seconds(self) -> u64

Whole seconds since this scale’s epoch (truncated).

Source

pub fn as_seconds_f64(self) -> f64

Seconds as f64. For large timestamps (> ~2^53 ns), precision loss affects even milliseconds

Source§

impl<S: TimeScale> Time<S>

Source

pub fn to_tai(self) -> Result<Time<Tai>, GnssTimeError>

Convert to TAI using the scale’s fixed offset.

Returns GnssTimeError::LeapSecondsRequired for contextual scales (UTC, GLONASS) and GnssTimeError::Overflow for out-of-range results.

Source

pub fn from_tai(tai: Time<Tai>) -> Result<Self, GnssTimeError>

Construct Time<S> from a TAI timestamp using the scale’s fixed offset.

Source

pub fn try_convert<T: TimeScale>(self) -> Result<Time<T>, GnssTimeError>

Convert directly between two fixed-offset scales via TAI.

Fails if either source or target scale requires leap seconds.

Source§

impl<S: TimeScale> Time<S>

Source

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

Add a Duration, returning None on overflow or underflow.

Source

pub fn checked_sub_duration(self, d: Duration) -> Option<Self>

Subtract a Duration, returning None on overflow or underflow.

Source

pub fn saturating_add(self, d: Duration) -> Self

Add, saturating at EPOCH (below) and MAX (above).

Source

pub fn saturating_sub_duration(self, d: Duration) -> Self

Subtract duration, saturating at bounds.

Source

pub fn try_add(self, d: Duration) -> Result<Self, GnssTimeError>

Fallible add — GnssTimeError::Overflow on failure.

Source

pub fn try_sub_duration(self, d: Duration) -> Result<Self, GnssTimeError>

Fallible subtract — GnssTimeError::Overflow on failure.

Source§

impl<S: TimeScale> Time<S>

Source

pub const fn checked_elapsed(self, earlier: Time<S>) -> Option<Duration>

Signed interval self − earlier. Returns None if it overflows i64.

Source§

impl Time<Glonass>

Source

pub fn from_day_tod(day: u32, tod: DurationParts) -> Result<Self, GnssTimeError>

Construct from GLONASS day number and time-of-day.

tod.seconds must be in [0, 86_400). tod.nanos must be in [0, 1_000_000_000).

§Errors

GnssTimeError::InvalidInput if tod_s ∉ [0, 86 400).

Source

pub const fn day(self) -> u32

Day number since GLONASS epoch.

Source

pub const fn tod_seconds(self) -> u32

Time of day in whole seconds.

Source

pub const fn sub_second_nanos(self) -> u32

Sub-second nanosecond remainder within the current second.

Source

pub const fn day_of_week(self) -> u8

Day of week: 1 = Monday … 7 = Sunday (NavIC / ISO 8601 convention).

GLONASS epoch (1996-01-01) was a Monday, so day 0 → 1 (Monday).

The formula is simply (day % 7) + 1.

§GLONASS ICD note

The GLONASS Interface Control Document defines the “day number within the four-year interval” (N_T) starting from 1, but for simplicity this crate uses 0-based day counts from the epoch and exposes the ISO / NavIC weekday (1=Mon … 7=Sun) through this method.

§Examples
use gnss_time::{scale::Glonass, DurationParts, Time};

// Day 0 = 1996-01-01 = Monday
let t = Time::<Glonass>::from_day_tod(
    0,
    DurationParts {
        seconds: 0,
        nanos: 0,
    },
)
.unwrap();

assert_eq!(t.day_of_week(), 1); // Monday

// Day 6 = 1996-01-07 = Sunday
let t2 = Time::<Glonass>::from_day_tod(
    6,
    DurationParts {
        seconds: 0,
        nanos: 0,
    },
)
.unwrap();

assert_eq!(t2.day_of_week(), 7); // Sunday

// Day 7 = 1996-01-08 = Monday again
let t3 = Time::<Glonass>::from_day_tod(
    7,
    DurationParts {
        seconds: 0,
        nanos: 0,
    },
)
.unwrap();

assert_eq!(t3.day_of_week(), 1);
Source

pub const fn is_weekend(self) -> bool

Returns true if the current day-of-week is Saturday (6) or Sunday (7).

Source§

impl Time<Gps>

Source

pub fn from_week_tow( week: u16, tow: DurationParts, ) -> Result<Self, GnssTimeError>

Construct from GPS week number and time-of-week.

tow.seconds must be in [0, 604_800). tow.nanos must be in [0, 1_000_000_000).

Source

pub fn to_utc(self) -> Result<Time<Utc>, GnssTimeError>

Conversion of GPS time to UTC using the built-in leap seconds table.

§Accuracy

For most timestamps, the conversion is accurate to the nanosecond. During a leap second insertion window (e.g. 2016-12-31 23:59:60 UTC), the result may differ by up to 1 second. If this is critical, use to_utc_with with a custom provider that properly handles the ambiguity.

Source

pub fn to_utc_with<P: LeapSecondsProvider>( self, ls: &P, ) -> Result<Time<Utc>, GnssTimeError>

Conversion of GPS time to UTC using a custom leap seconds provider.

The same accuracy notes apply as for to_utc: the conversion is precise for most timestamps, but during a leap second insertion window it may differ by up to 1 second.

Source

pub const fn week(self) -> u32

GPS week number.

Source

pub const fn tow_seconds(self) -> u32

Time of week in whole seconds.

Source

pub const fn sub_second_nanos(self) -> u32

Sub-second nanosecond remainder within the current second.

Source§

impl Time<Utc>

Source

pub fn to_gps(self) -> Result<Time<Gps>, GnssTimeError>

Conversion of UTC time to GPS using the built-in leap seconds table.

§Accuracy

Same as in to_utc — ambiguity may occur during leap second insertion events.

Source

pub fn to_gps_with<P: LeapSecondsProvider>( self, ls: &P, ) -> Result<Time<Gps>, GnssTimeError>

Conversion of UTC time to GPS using a custom leap seconds provider.

The same accuracy notes apply as for to_gps: ambiguity may occur during leap second insertion events.

Trait Implementations§

Source§

impl<S: TimeScale> Add<Duration> for Time<S>

Source§

type Output = Time<S>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Duration) -> Time<S>

Performs the + operation. Read more
Source§

impl<S: TimeScale> AddAssign<Duration> for Time<S>

Source§

fn add_assign(&mut self, rhs: Duration)

Performs the += operation. Read more
Source§

impl<S: Clone + TimeScale> Clone for Time<S>

Source§

fn clone(&self) -> Time<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<S: TimeScale> Debug for Time<S>

Source§

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

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

impl<S: TimeScale> Display for Time<S>

Source§

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

Formatting depends on the DisplayStyle of the time scale:

StyleExample
WeekTow"GPS 2345:432000.000"
DayTod"GLO 10512:43200.000"
Simple"TAI +1000000000s 0ns"
Source§

impl<S: TimeScale> Format for Time<S>

Available on crate feature defmt only.
Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl<S: Hash + TimeScale> Hash for Time<S>

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 IntoScale<Beidou> for Time<Galileo>

Source§

fn into_scale(self) -> Result<Time<Beidou>, GnssTimeError>

Galileo -> BeiDou via TAI.

Source§

impl IntoScale<Beidou> for Time<Gps>

Source§

fn into_scale(self) -> Result<Time<Beidou>, GnssTimeError>

GPS -> BeiDou: BDT = GPS - 14s.

use gnss_time::{Beidou, Gps, IntoScale, Time};

let gps = Time::<Gps>::from_seconds(100);
let bdt: Time<Beidou> = gps.into_scale().unwrap();

assert_eq!(bdt.as_seconds(), 86); // 100 - 14 = 86
Source§

impl IntoScale<Galileo> for Time<Beidou>

Source§

fn into_scale(self) -> Result<Time<Galileo>, GnssTimeError>

BeiDou -> Galileo via TAI.

Source§

impl IntoScale<Galileo> for Time<Gps>

Source§

fn into_scale(self) -> Result<Time<Galileo>, GnssTimeError>

GPS -> Galileo: identical at nanosecond level (both use TAI − 19s).

GPS and Galileo timestamps with identical nanoseconds represent the same physical instant.

use gnss_time::{Galileo, Gps, IntoScale, Time};

let gps = Time::<Gps>::from_seconds(12_345);
let gal: Time<Galileo> = gps.into_scale().unwrap();

assert_eq!(gps.as_nanos(), gal.as_nanos());
Source§

impl IntoScale<Glonass> for Time<Utc>

Source§

fn into_scale(self) -> Result<Time<Glonass>, GnssTimeError>

UTC -> GLONASS: постоянный сдвиг эпохи.

§Errors

GnssTimeError::Overflow если UTC раньше эпохи GLONASS (1995-12-31 21:00:00 UTC).

Source§

impl IntoScale<Gps> for Time<Beidou>

Source§

fn into_scale(self) -> Result<Time<Gps>, GnssTimeError>

BeiDou -> GPS: GPS = BDT + 14s.

use gnss_time::{Beidou, Gps, IntoScale, Time};

let bdt = Time::<Beidou>::from_seconds(86);
let gps: Time<Gps> = bdt.into_scale().unwrap();

assert_eq!(gps.as_seconds(), 100); // 86 - 19 + 33 = 100
Source§

impl IntoScale<Gps> for Time<Galileo>

Source§

fn into_scale(self) -> Result<Time<Gps>, GnssTimeError>

Converts the value into the target time scale. Read more
Source§

impl IntoScale<Gps> for Time<Tai>

Source§

fn into_scale(self) -> Result<Time<Gps>, GnssTimeError>

TAI -> GPS: subtract 19 seconds.

use gnss_time::{Gps, IntoScale, Tai, Time};

let tai = Time::<Tai>::from_seconds(119);
let gps: Time<Gps> = tai.into_scale().unwrap();

assert_eq!(gps.as_seconds(), 100);
Source§

impl IntoScale<Tai> for Time<Gps>

Source§

fn into_scale(self) -> Result<Time<Tai>, GnssTimeError>

GPS -> TAI: add 19 seconds (constant, no leap seconds).

use gnss_time::{Gps, IntoScale, Tai, Time};

let gps = Time::<Gps>::from_seconds(100);
let tai: Time<Tai> = gps.into_scale().unwrap();

assert_eq!(tai.as_seconds(), 119);
Source§

impl IntoScale<Utc> for Time<Glonass>

Source§

fn into_scale(self) -> Result<Time<Utc>, GnssTimeError>

GLONASS -> UTC: fixed epoch shift.

GLONASS uses UTC(SU), a time scale offset from UTC by +3 hours and including leap seconds.

use gnss_time::{DurationParts, Glonass, IntoScale, Time, Utc};

let glo = Time::<Glonass>::from_day_tod(
    0,
    DurationParts {
        seconds: 0,
        nanos: 0,
    },
)
.unwrap(); // GLONASS epoch
let utc: Time<Utc> = glo.into_scale().unwrap();

// UTC at the GLONASS epoch:
// 1995-12-31 21:00:00 UTC = 757_371_600 s from 1972
assert_eq!(utc.as_nanos(), 757_371_600_000_000_000);
Source§

impl IntoScaleWith<Beidou> for Time<Glonass>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Beidou>, GnssTimeError>

GLONASS -> BeiDou via UTC.

Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Beidou>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Beidou> for Time<Utc>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Beidou>, GnssTimeError>

UTC → BeiDou via GPS.

Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Beidou>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Galileo> for Time<Glonass>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Galileo>, GnssTimeError>

GLONASS -> Galileo via UTC.

Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Galileo>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Galileo> for Time<Utc>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Galileo>, GnssTimeError>

UTC -> Galileo via GPS.

Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Galileo>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Glonass> for Time<Beidou>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Glonass>, GnssTimeError>

Converts using leap-second data.
Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Glonass>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Glonass> for Time<Galileo>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Glonass>, GnssTimeError>

Converts using leap-second data.
Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Glonass>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Glonass> for Time<Gps>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Glonass>, GnssTimeError>

Converts using leap-second data.
Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Glonass>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Gps> for Time<Glonass>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Gps>, GnssTimeError>

GLONASS -> GPS via UTC.

Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Gps>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Gps> for Time<Utc>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Gps>, GnssTimeError>

UTC -> GPS with leap-second context.

use gnss_time::{DurationParts, Gps, IntoScale, IntoScaleWith, LeapSeconds, Time, Utc};

let ls = LeapSeconds::builtin();
let gps_orig = Time::<Gps>::from_week_tow(
    2086,
    DurationParts {
        seconds: 0,
        nanos: 0,
    },
)
.unwrap();
let utc: Time<Utc> = gps_orig.into_scale_with(ls).unwrap();
let gps_back: Time<Gps> = utc.into_scale_with(ls).unwrap();

assert_eq!(gps_orig, gps_back);
Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Gps>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Utc> for Time<Beidou>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Utc>, GnssTimeError>

BeiDou -> UTC via GPS.

Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Utc>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Utc> for Time<Galileo>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Utc>, GnssTimeError>

Galileo -> UTC via GPS (both share the same TAI offset of 19s).

Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Utc>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl IntoScaleWith<Utc> for Time<Gps>

Source§

fn into_scale_with<P: LeapSecondsProvider>( self, ls: P, ) -> Result<Time<Utc>, GnssTimeError>

GPS -> UTC with leap-second context.

Round-trip consistency: GPS -> UTC -> GPS is exact (< 1 ns) for all moments except the one-second leap-second insertion window.

use gnss_time::{Gps, IntoScaleWith, LeapSeconds, Time, Utc};

let ls = LeapSeconds::builtin();
let gps = Time::<Gps>::from_seconds(1_167_264_018); // 2017-01-01 GPS
let utc: Time<Utc> = gps.into_scale_with(ls).unwrap();

let delta = gps.as_seconds() as i64 - utc.as_seconds() as i64 + 252_892_800_i64;

// GPS leads UTC by 18 s → UTC is 18 s earlier
assert_eq!(delta, 18);
Source§

fn into_scale_with_checked<P: LeapSecondsProvider>( self, ls: P, ) -> Result<ConvertResult<Time<Utc>>, GnssTimeError>

Converts and reports whether the result is ambiguous due to a leap-second insertion.
Source§

impl<S: TimeScale> Ord for Time<S>

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

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

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

impl<S: PartialEq + TimeScale> PartialEq for Time<S>

Source§

fn eq(&self, other: &Time<S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S: TimeScale> PartialOrd for Time<S>

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 · 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 · 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 · 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 · 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<S: TimeScale> Sub<Duration> for Time<S>

Source§

type Output = Time<S>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Duration) -> Self::Output

Performs the - operation. Read more
Source§

impl<S: TimeScale> Sub for Time<S>

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Time<S>) -> Self::Output

Performs the - operation. Read more
Source§

impl<S: TimeScale> SubAssign<Duration> for Time<S>

Source§

fn sub_assign(&mut self, rhs: Duration)

Performs the -= operation. Read more
Source§

impl<S: Copy + TimeScale> Copy for Time<S>

Source§

impl<S: Eq + TimeScale> Eq for Time<S>

Source§

impl<S: TimeScale> StructuralPartialEq for Time<S>

Auto Trait Implementations§

§

impl<S> Freeze for Time<S>

§

impl<S> RefUnwindSafe for Time<S>
where S: RefUnwindSafe,

§

impl<S> Send for Time<S>
where S: Send,

§

impl<S> Sync for Time<S>
where S: Sync,

§

impl<S> Unpin for Time<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Time<S>

§

impl<S> UnwindSafe for Time<S>
where S: UnwindSafe,

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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.