Skip to main content

Timestamp

Struct Timestamp 

Source
pub struct Timestamp {
    padding: Padding,
    nanoseconds: ru32<0, 999_999_999>,
    seconds: ri64<{ _ }, { _ }>,
}
Expand description

A Unix timestamp with nanosecond precision.

This type represents a point in time as a number of seconds and nanoseconds elapsed since the Unix epoch (1970-01-01 00:00:00 UTC). Negative values represent times before the Unix epoch.

Fields§

§padding: Padding
Available on little-endian only.
§nanoseconds: ru32<0, 999_999_999>
Available on little-endian only.
§seconds: ri64<{ _ }, { _ }>
Available on little-endian only.

Implementations§

Source§

impl Timestamp

Source

pub const UNIX_EPOCH: Self

A Timestamp representing the Unix epoch (1970-01-01 00:00:00 UTC).

Source

pub const MIN: Self

The minimum valid Timestamp.

The moment in time represented by this value may vary depending on the feature flags enabled.

Source

pub const MAX: Self

The maximum valid Timestamp.

The moment in time represented by this value may vary depending on the feature flags enabled.

Source

const fn as_i128(self) -> i128

Source

pub fn now() -> Self

Available on crate feature std only.

Create a new Timestamp representing the current moment in time.

assert!(Timestamp::now().year() >= 2019);
Source

#[doc(hidden)]
pub const unsafe fn __new_unchecked(seconds: i64, nanoseconds: u32) -> Self

Create a Timestamp from the provided seconds and nanoseconds values without checking if they are valid.

§Safety

Both seconds and nanoseconds must be in range.

Source

pub(crate) const fn new_ranged( seconds: ri64<{ _ }, { _ }>, nanoseconds: ru32<0, 999_999_999>, ) -> Self

Create a Timestamp from the provided seconds and nanoseconds values that are known to be in range.

Source

pub const fn new(seconds: i64, nanoseconds: u32) -> Result<Self, ComponentRange>

Create a Timestamp from the provided Unix timestamp in seconds and nanoseconds, returning an error if the resulting value is out of range.

assert!(Timestamp::new(0, 0).is_ok());
assert!(Timestamp::new(i64::MAX, 0).is_err());
Source

pub const fn from_seconds(seconds: i64) -> Result<Self, ComponentRange>

Create a Timestamp from the provided Unix timestamp in seconds, returning an error if the resulting value is out of range.

assert!(Timestamp::from_seconds(0).is_ok());
assert!(Timestamp::from_seconds(i64::MAX).is_err());
Source

pub const fn from_milliseconds( milliseconds: i64, ) -> Result<Self, ComponentRange>

Create a Timestamp from the provided Unix timestamp in milliseconds, returning an error if the resulting value is out of range.

assert!(Timestamp::from_milliseconds(0).is_ok());
assert!(Timestamp::from_milliseconds(i64::MAX).is_err());
Source

pub const fn from_microseconds( microseconds: i128, ) -> Result<Self, ComponentRange>

Create a Timestamp from the provided Unix timestamp in microseconds, returning an error if the resulting value is out of range.

assert!(Timestamp::from_microseconds(0).is_ok());
assert!(Timestamp::from_microseconds(i128::MAX).is_err());
Source

pub const fn from_nanoseconds(nanoseconds: i128) -> Result<Self, ComponentRange>

Create a Timestamp from the provided Unix timestamp in nanoseconds, returning an error if the resulting value is out of range.

assert!(Timestamp::from_nanoseconds(0).is_ok());
assert!(Timestamp::from_nanoseconds(i128::MAX).is_err());
Source

pub const fn to_offset(self, offset: UtcOffset) -> OffsetDateTime

Convert the Timestamp to an OffsetDateTime at the provided offset.

assert_eq!(timestamp!(1_546_398_245).to_offset(offset!(+1)).hour(), 4);
§Panics

This panics if the resulting date-time with the provided offset is outside the supported range. Consider using checked_to_offset for a non-panicking alternative.

Source

pub const fn checked_to_offset( self, offset: UtcOffset, ) -> Option<OffsetDateTime>

Convert the Timestamp to an OffsetDateTime with the provided offset, returning None if the resulting value is out of range.

assert!(
    timestamp!(1_546_398_245)
        .checked_to_offset(offset!(+1))
        .is_some()
);
Source

pub const fn to_utc(self) -> UtcDateTime

Convert the Timestamp to a UtcDateTime.

assert_eq!(timestamp!(1_546_398_245).to_utc(), utc_datetime!(2019-01-02 3:04:05));
Source

pub(crate) const fn as_parts_ranged( self, ) -> (ri64<{ _ }, { _ }>, ru32<0, 999_999_999>)

Get the seconds and nanoseconds of the timestamp as ranged values.

Source

pub const fn as_seconds(self) -> i64

Get the number of seconds since the Unix epoch.

Negative values represent moments before the Unix epoch.

assert_eq!(timestamp!(1_546_398_245).as_seconds(), 1_546_398_245);
Source

pub const fn as_milliseconds(self) -> i64

Get the number of milliseconds since the Unix epoch.

Negative values represent moments before the Unix epoch.

assert_eq!(
    timestamp!(1_546_398_245.006).as_milliseconds(),
    1_546_398_245_006
);
Source

pub const fn as_microseconds(self) -> i128

Get the number of microseconds since the Unix epoch.

Negative values represent moments before the Unix epoch.

assert_eq!(
    timestamp!(1_546_398_245.006_007).as_microseconds(),
    1_546_398_245_006_007
);
Source

pub const fn as_nanoseconds(self) -> i128

Get the number of nanoseconds since the Unix epoch.

Negative values represent moments before the Unix epoch.

assert_eq!(
    timestamp!(1_546_398_245.006_007_008).as_nanoseconds(),
    1_546_398_245_006_007_008
);
Source

pub const fn date(self) -> Date

Get the Date of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).date(), date!(2019-01-02));
Source

pub const fn time(self) -> Time

Get the Time of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).time(), time!(3:04:05));
Source

const fn year_leap_ordinal(self) -> (i32, bool, u16)

Compute the year, leap year status, and ordinal day of the timestamp in UTC.

This algorithm is essentially identical to Date::from_julian_day_unchecked. Instead of returning Date, it returns the components as a tuple. By not bitpacking the values, it allows the compiler to see through the function boundary and better optimize methods.

Source

pub const fn year(self) -> i32

Get the year of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).year(), 2019);
Source

pub const fn month(self) -> Month

Get the month of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).month(), Month::January);
Source

pub const fn day(self) -> u8

Get the day of the month of the timestamp in UTC.

The returned value will always be in the range 1..=31.

assert_eq!(timestamp!(1_546_398_245).day(), 2);
Source

pub const fn ordinal(self) -> u16

Get the day of the year of the timestamp in UTC.

The returned value will always be in the range 1..=366.

assert_eq!(timestamp!(1_546_398_245).ordinal(), 2);
Source

pub const fn iso_week(self) -> u8

Get the ISO week number of the timestamp in UTC.

The returned value will always be in the range 1..=53.

assert_eq!(timestamp!(1_546_398_245).iso_week(), 1);
Source

pub const fn sunday_based_week(self) -> u8

Get the Sunday-based week number of the timestamp in UTC.

The returned value will always be in the range 0..=53.

Source

pub const fn monday_based_week(self) -> u8

Get the Monday-based week number of the timestamp in UTC.

The returned value will always be in the range 0..=53.

Source

pub const fn to_calendar_date(self) -> (i32, Month, u8)

Get the calendar date (year, month, day) of the timestamp in UTC.

assert_eq!(
    timestamp!(1_546_398_245).to_calendar_date(),
    (2019, Month::January, 2)
);
Source

pub const fn to_ordinal_date(self) -> (i32, u16)

Get the ordinal date (year, ordinal day) of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).to_ordinal_date(), (2019, 2));
Source

pub const fn to_iso_week_date(self) -> (i32, u8, Weekday)

Get the ISO week date (year, week number, weekday) of the timestamp in UTC.

assert_eq!(
    timestamp!(1_546_398_245).to_iso_week_date(),
    (2019, 1, Weekday::Wednesday)
);
Source

pub const fn weekday(self) -> Weekday

Get the weekday of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).weekday(), Weekday::Wednesday);
Source

pub const fn to_julian_day(self) -> i32

Get the Julian day of the timestamp.

Source

pub const fn as_hms(self) -> (u8, u8, u8)

Get the hours, minutes, and seconds of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).as_hms(), (3, 4, 5));
Source

pub const fn as_hms_milli(self) -> (u8, u8, u8, u16)

Get the hours, minutes, seconds, and milliseconds of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245.006).as_hms_milli(), (3, 4, 5, 6));
Source

pub const fn as_hms_micro(self) -> (u8, u8, u8, u32)

Get the hours, minutes, seconds, and microseconds of the timestamp in UTC.

assert_eq!(
    timestamp!(1_546_398_245.006_007).as_hms_micro(),
    (3, 4, 5, 6_007)
);
Source

pub const fn as_hms_nano(self) -> (u8, u8, u8, u32)

Get the hours, minutes, seconds, and nanoseconds of the timestamp in UTC.

assert_eq!(
    timestamp!(1_546_398_245.006_007_008).as_hms_nano(),
    (3, 4, 5, 6_007_008)
);
Source

pub const fn hour(self) -> u8

Get the hour of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).hour(), 3);
Source

pub const fn minute(self) -> u8

Get the minute of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).minute(), 4);
Source

pub const fn second(self) -> u8

Get the second of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245).second(), 5);
Source

pub const fn millisecond(self) -> u16

Get the millisecond of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245.006).millisecond(), 6);
Source

pub const fn microsecond(self) -> u32

Get the microsecond of the timestamp in UTC.

assert_eq!(timestamp!(1_546_398_245.006_007).microsecond(), 6_007);
Source

pub const fn nanosecond(self) -> u32

Get the nanosecond of the timestamp in UTC.

assert_eq!(
    timestamp!(1_546_398_245.006_007_008).nanosecond(),
    6_007_008
);
Source

const fn add(self, duration: Duration) -> Result<Self, Overflow>

Add a Duration to the timestamp. Returns Overflow::Positive or Overflow::Negative if the result is out of range.

Source

const fn sub(self, duration: Duration) -> Result<Self, Overflow>

Subtract a Duration from the timestamp. Returns Overflow::Positive or Overflow::Negative if the result is out of range.

Source

const fn add_std(self, duration: StdDuration) -> Result<Self, Overflow>

Add a std::time::Duration to the timestamp. Returns Overflow::Positive or Overflow::Negative if the result is out of range.

Source

const fn sub_std(self, duration: StdDuration) -> Result<Self, Overflow>

Subtract a std::time::Duration from the timestamp. Returns Overflow::Positive or Overflow::Negative if the result is out of range.

Source

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

Checked addition of a Duration, returning None if the result is out of range.

assert_eq!(
    timestamp!(1_546_398_245).checked_add(1.days()),
    Some(timestamp!(1_546_484_645))
);
assert_eq!(
    timestamp!(1_546_398_245).checked_add((-1).days()),
    Some(timestamp!(1_546_311_845))
);
Source

pub const fn checked_sub(self, duration: Duration) -> Option<Self>

Checked subtraction of a Duration, returning None if the result is out of range.

assert_eq!(
    timestamp!(1_546_398_245).checked_sub(1.days()),
    Some(timestamp!(1_546_311_845))
);
assert_eq!(
    timestamp!(1_546_398_245).checked_sub((-1).days()),
    Some(timestamp!(1_546_484_645))
);
Source

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

Saturating addition of a Duration.

Returns Timestamp::MAX or Timestamp::MIN if the result is out of range.

assert_eq!(
    timestamp!(1_546_398_245).saturating_add(1.days()),
    timestamp!(1_546_484_645)
);
assert_eq!(Timestamp::MAX.saturating_add(1.days()), Timestamp::MAX);
assert_eq!(Timestamp::MIN.saturating_add((-1).days()), Timestamp::MIN);
Source

pub const fn saturating_sub(self, duration: Duration) -> Self

Saturating subtraction of a Duration.

Returns Timestamp::MAX or Timestamp::MIN if the result is out of range.

assert_eq!(
    timestamp!(1_546_398_245).saturating_sub(1.days()),
    timestamp!(1_546_311_845)
);
assert_eq!(Timestamp::MIN.saturating_sub(1.days()), Timestamp::MIN);
assert_eq!(Timestamp::MAX.saturating_sub((-1).days()), Timestamp::MAX);
Source§

impl Timestamp

Methods that replace part of the Timestamp.

Source

pub const fn replace_time(self, time: Time) -> Self

Replace the time, preserving the date.

assert_eq!(
    timestamp!(1_546_398_245).replace_time(time!(12:34:56)),
    timestamp!(1_546_432_496)
);
Source

pub const fn replace_date(self, date: Date) -> Self

Replace the date, preserving the time.

assert_eq!(
    timestamp!(1_546_398_245).replace_date(date!(2020-01-02)),
    timestamp!(1_577_934_245)
);
Source

pub const fn replace_year(self, year: i32) -> Result<Self, ComponentRange>

Replace the year, preserving the month and day. If the date is February 29 and the resulting year is not a leap year, an error is returned.

assert_eq!(
    timestamp!(1_546_398_245).replace_year(2020),
    Ok(timestamp!(1_577_934_245))
);
assert!(timestamp!(1_546_398_245).replace_year(-1_000_000).is_err()); // -1_000_000 isn't a valid year
assert!(timestamp!(1_546_398_245).replace_year(1_000_000).is_err()); // 1_000_000 isn't a valid year
Source

pub const fn replace_month(self, month: Month) -> Result<Self, ComponentRange>

Replace the month of the year, preserving the year and day. If the day is invalid for the resulting month, an error is returned.

assert_eq!(
    timestamp!(1_546_398_245).replace_month(Month::February),
    Ok(timestamp!(1_549_076_645))
);
assert!(
    timestamp!(1_548_817_445)
        .replace_month(Month::February)
        .is_err()
); // the day of the month is 30, which is invalid for February
Source

pub const fn replace_day(self, day: u8) -> Result<Self, ComponentRange>

Replace the day of the month.

assert_eq!(
    timestamp!(1_546_398_245).replace_day(1),
    Ok(timestamp!(1_546_311_845))
);
assert!(timestamp!(1_546_398_245).replace_day(0).is_err()); // 00 isn't a valid day
assert!(timestamp!(1_546_398_245).replace_day(32).is_err()); // 32 isn't a valid day
Source

pub const fn replace_ordinal(self, ordinal: u16) -> Result<Self, ComponentRange>

Replace the day of the year.

assert_eq!(
    timestamp!(1_546_398_245).replace_ordinal(1),
    Ok(timestamp!(1_546_311_845))
);
assert!(timestamp!(1_546_398_245).replace_ordinal(0).is_err()); // 0 isn't a valid day of the year
assert!(timestamp!(1_546_398_245).replace_ordinal(366).is_err()); // the timestamp is in 2019, which isn't a leap year
Source

pub const fn replace_hour(self, hour: u8) -> Result<Self, ComponentRange>

Replace the clock hour.

assert_eq!(
    timestamp!(1_546_398_245).replace_hour(0),
    Ok(timestamp!(1_546_387_445))
);
assert!(timestamp!(1_546_398_245).replace_hour(24).is_err()); // 24 isn't a valid hour
Source

pub const fn replace_minute(self, minute: u8) -> Result<Self, ComponentRange>

Replace the minutes within the hour.

assert_eq!(
    timestamp!(1_546_398_245).replace_minute(0),
    Ok(timestamp!(1_546_398_005))
);
assert!(timestamp!(1_546_398_245).replace_minute(60).is_err()); // 60 isn't a valid minute
Source

pub const fn replace_second(self, second: u8) -> Result<Self, ComponentRange>

Replace the seconds within the minute.

assert_eq!(
    timestamp!(1_546_398_245).replace_second(0),
    Ok(timestamp!(1_546_398_240))
);
assert!(timestamp!(1_546_398_245).replace_second(60).is_err()); // 60 isn't a valid second
Source

pub const fn replace_millisecond( self, millisecond: u16, ) -> Result<Self, ComponentRange>

Replace the milliseconds within the second.

assert_eq!(
    timestamp!(1_546_398_245.006).replace_millisecond(7),
    Ok(timestamp!(1_546_398_245.007))
);
assert!(
    timestamp!(1_546_398_245.006)
        .replace_millisecond(1_000)
        .is_err()
); // 1_000 isn't a valid millisecond
Source

pub const fn replace_microsecond( self, microsecond: u32, ) -> Result<Self, ComponentRange>

Replace the microseconds within the second.

assert_eq!(
    timestamp!(1_546_398_245.006_007).replace_microsecond(123_456),
    Ok(timestamp!(1_546_398_245.123_456))
);
assert!(
    timestamp!(1_546_398_245.006_007)
        .replace_microsecond(1_000_000)
        .is_err()
); // 1_000_000 isn't a valid microsecond
Source

pub const fn replace_nanosecond( self, nanosecond: u32, ) -> Result<Self, ComponentRange>

Replace the nanoseconds within the second.

assert_eq!(
    timestamp!(1_546_398_245.006_007_008).replace_nanosecond(123_456_789),
    Ok(timestamp!(1_546_398_245.123_456_789))
);
assert!(
    timestamp!(1_546_398_245.006_007_008)
        .replace_nanosecond(1_000_000_000)
        .is_err()
); // 1_000_000_000 isn't a valid nanosecond
Source

const fn replace_nanosecond_ranged( self, new_nanos: ru32<0, 999_999_999>, ) -> Self

Replace the nanoseconds within the second using a range-bounded integer to avoid range checks.

Source§

impl Timestamp

Source

pub fn format_into( self, output: &mut (impl Write + ?Sized), format: &(impl Formattable + ?Sized), ) -> Result<usize, Format>

Available on crate feature formatting only.

Format the Timestamp using the provided format description.

Source

pub fn format( self, format: &(impl Formattable + ?Sized), ) -> Result<String, Format>

Available on crate feature formatting only.

Format the Timestamp using the provided format description.

let format = format_description!("[unix_timestamp]");
assert_eq!(timestamp!(1_546_398_245).format(&format)?, "1546398245");
Source§

impl Timestamp

Source

pub fn parse( input: &str, description: &(impl Parsable + ?Sized), ) -> Result<Self, Parse>

Available on crate feature parsing only.

Parse a Timestamp from the input using the provided format description.

let format = format_description!("[unix_timestamp]");
assert_eq!(
    Timestamp::parse("1546398245", &format)?,
    timestamp!(1_546_398_245),
);
Source§

impl Timestamp

Source

const DISPLAY_BUFFER_SIZE: usize = 25

The maximum number of bytes that the fmt_into_buffer method will write, which is also used by the Display implementation.

Source

pub(crate) fn fmt_into_buffer(self, buf: &mut [MaybeUninit<u8>; 25]) -> usize

Format the Timestamp into the provided buffer, returning the number of bytes written.

Trait Implementations§

Source§

impl Add<Duration> for Timestamp

Source§

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

§Panics

This may panic if an overflow occurs.

Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

impl Add<Duration> for Timestamp

Source§

fn add(self, rhs: StdDuration) -> Self::Output

§Panics

This may panic if an overflow occurs.

Source§

type Output = Timestamp

The resulting type after applying the + operator.
Source§

impl AddAssign<Duration> for Timestamp

Source§

fn add_assign(&mut self, rhs: Duration)

§Panics

This may panic if an overflow occurs.

Source§

impl AddAssign<Duration> for Timestamp

Source§

fn add_assign(&mut self, rhs: StdDuration)

§Panics

This may panic if an overflow occurs.

Source§

impl Arbitrary for Timestamp

Available on crate feature quickcheck only.
Source§

fn arbitrary(g: &mut Gen) -> Self

Return an arbitrary value. Read more
Source§

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>

Return an iterator of values that are smaller than itself. Read more
Source§

impl Clone for Timestamp

Source§

fn clone(&self) -> Timestamp

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 ComponentProvider for Timestamp

Available on crate feature formatting only.
Source§

const SUPPLIES_DATE: bool = true

Whether the type can provide date components, indicating that date-related methods can be called.
Source§

const SUPPLIES_TIME: bool = true

Whether the type can provide time components, indicating that time-related methods can be called.
Source§

const SUPPLIES_OFFSET: bool = true

Whether the type can provide offset components, indicating that offset-related methods can be called.
Source§

const SUPPLIES_TIMESTAMP: bool = true

Whether the type can provide timestamp components, indicating that timestamp-related methods can be called.
Source§

type State = TimestampState

The state type used by the provider, allowing for caching of computed values.
Source§

fn day(&self, state: &mut Self::State) -> ru8<1, 31>

Obtain the day of the month.
Source§

fn month(&self, state: &mut Self::State) -> Month

Obtain the month of the year.
Source§

fn ordinal(&self, state: &mut Self::State) -> ru16<1, 366>

Obtain the ordinal day of the year.
Source§

fn weekday(&self, state: &mut Self::State) -> Weekday

Obtain the day of the week.
Source§

fn iso_week_number(&self, state: &mut Self::State) -> ru8<1, 53>

Obtain the ISO week number.
Source§

fn monday_based_week(&self, state: &mut Self::State) -> ru8<0, 53>

Obtain the Monday-based week number.
Source§

fn sunday_based_week(&self, state: &mut Self::State) -> ru8<0, 53>

Obtain the Sunday-based week number.
Source§

fn calendar_year(&self, state: &mut Self::State) -> ri32<-999_999, 999_999>

Obtain the calendar year.
Source§

fn iso_year(&self, state: &mut Self::State) -> ri32<-999_999, 999_999>

Obtain the ISO week-based year.
Source§

fn hour(&self, state: &mut Self::State) -> ru8<0, { _ }>

Obtain the hour within the day.
Source§

fn minute(&self, state: &mut Self::State) -> ru8<0, { _ }>

Obtain the minute within the hour.
Source§

fn period(&self, state: &mut Self::State) -> Period

Obtain the period of the day (AM/PM).
Source§

fn second(&self, state: &mut Self::State) -> ru8<0, { _ }>

Obtain the second within the minute.
Source§

fn nanosecond(&self, _: &mut Self::State) -> ru32<0, { _ }>

Obtain the nanosecond within the second.
Source§

fn offset_is_negative(&self, _: &mut Self::State) -> bool

Obtain whether the offset is negative.
Source§

fn offset_is_utc(&self, _: &mut Self::State) -> bool

Obtain whether the offset is UTC.
Source§

fn offset_hour(&self, _: &mut Self::State) -> ri8<-25, 25>

Obtain the hour component of the UTC offset.
Source§

fn offset_minute(&self, _: &mut Self::State) -> ri8<{ _ }, { _ }>

Obtain the minute component of the UTC offset.
Source§

fn offset_second(&self, _: &mut Self::State) -> ri8<{ _ }, { _ }>

Obtain the second component of the UTC offset.
Source§

fn unix_timestamp_seconds(&self, _: &mut Self::State) -> i64

Obtain the Unix timestamp in seconds.
Source§

fn unix_timestamp_milliseconds(&self, _: &mut Self::State) -> i64

Obtain the Unix timestamp in milliseconds.
Source§

fn unix_timestamp_microseconds(&self, _: &mut Self::State) -> i128

Obtain the Unix timestamp in microseconds.
Source§

fn unix_timestamp_nanoseconds(&self, _: &mut Self::State) -> i128

Obtain the Unix timestamp in nanoseconds.
Source§

impl Copy for Timestamp

Source§

impl Debug for Timestamp

Source§

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

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

impl<'a> Deserialize<'a> for Timestamp

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'a>,

Deserialize this value from the given Serde deserializer. Read more
Source§

#[doc(hidden)]
fn deserialize_in_place<D>( deserializer: D, place: &mut Self, ) -> Result<(), <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserializes a value into self from the given Deserializer. Read more
Source§

impl Display for Timestamp

Source§

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

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

impl Distribution<Timestamp> for StandardUniform

Available on crate feature rand010 only.
Source§

fn sample<R>(&self, rng: &mut R) -> Timestamp
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
§

fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
§

fn map<F, S>(self, func: F) -> Map<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Map sampled values to type S Read more
Source§

impl Distribution<Timestamp> for Standard

Available on crate feature rand08 only.
Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Timestamp

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl Distribution<Timestamp> for StandardUniform

Available on crate feature rand09 only.
Source§

fn sample<R>(&self, rng: &mut R) -> Timestamp
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> Iter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> Map<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Map sampled values to type S Read more
Source§

impl Eq for Timestamp

Source§

#[doc(hidden)]
fn assert_fields_are_eq(&self)

🔬This is a nightly-only experimental API. (derive_eq_internals)
1.0.0 (const: unstable) · Source§

#[doc(hidden)]
fn assert_receiver_is_total_eq(&self)

👎Deprecated since 1.95.0:

implementation detail of #[derive(Eq)]

Source§

impl From<OffsetDateTime> for Timestamp

Source§

fn from(datetime: OffsetDateTime) -> Self

§Panics

This may panic if an overflow occurs.

Source§

impl From<SystemTime> for Timestamp

Available on crate feature std only.
Source§

fn from(datetime: SystemTime) -> Self

§Panics

This may panic if an overflow occurs.

Source§

impl From<Timestamp> for OffsetDateTime

Source§

fn from(timestamp: Timestamp) -> Self

Converts to this type from the input type.
Source§

impl From<Timestamp> for SystemTime

Available on crate feature std only.
Source§

fn from(timestamp: Timestamp) -> Self

§Panics

This may panic if an overflow occurs.

Source§

impl From<Timestamp> for UtcDateTime

Source§

fn from(timestamp: Timestamp) -> Self

Converts to this type from the input type.
Source§

impl From<UtcDateTime> for Timestamp

Source§

fn from(datetime: UtcDateTime) -> Self

Converts to this type from the input type.
Source§

impl Hash for Timestamp

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 Ord for Timestamp

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§

impl PartialEq for Timestamp

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialEq<OffsetDateTime> for Timestamp

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialEq<SystemTime> for Timestamp

Available on crate feature std only.
Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialEq<Timestamp> for OffsetDateTime

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialEq<Timestamp> for SystemTime

Available on crate feature std only.
Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialEq<Timestamp> for UtcDateTime

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialEq<UtcDateTime> for Timestamp

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 PartialOrd for Timestamp

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§

#[doc(hidden)]
fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
If self == other, returns ControlFlow::Continue(()). Otherwise, returns ControlFlow::Break(self < other). Read more
Source§

#[doc(hidden)]
fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for <= instead of <.
Source§

#[doc(hidden)]
fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for > instead of <.
Source§

#[doc(hidden)]
fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for >= instead of <.
Source§

impl PartialOrd<OffsetDateTime> for Timestamp

Source§

fn partial_cmp(&self, other: &OffsetDateTime) -> 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§

#[doc(hidden)]
fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
If self == other, returns ControlFlow::Continue(()). Otherwise, returns ControlFlow::Break(self < other). Read more
Source§

#[doc(hidden)]
fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for <= instead of <.
Source§

#[doc(hidden)]
fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for > instead of <.
Source§

#[doc(hidden)]
fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for >= instead of <.
Source§

impl PartialOrd<SystemTime> for Timestamp

Available on crate feature std only.
Source§

fn partial_cmp(&self, other: &SystemTime) -> 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§

#[doc(hidden)]
fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
If self == other, returns ControlFlow::Continue(()). Otherwise, returns ControlFlow::Break(self < other). Read more
Source§

#[doc(hidden)]
fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for <= instead of <.
Source§

#[doc(hidden)]
fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for > instead of <.
Source§

#[doc(hidden)]
fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for >= instead of <.
Source§

impl PartialOrd<Timestamp> for OffsetDateTime

Source§

fn partial_cmp(&self, other: &Timestamp) -> 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§

#[doc(hidden)]
fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
If self == other, returns ControlFlow::Continue(()). Otherwise, returns ControlFlow::Break(self < other). Read more
Source§

#[doc(hidden)]
fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for <= instead of <.
Source§

#[doc(hidden)]
fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for > instead of <.
Source§

#[doc(hidden)]
fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for >= instead of <.
Source§

impl PartialOrd<Timestamp> for SystemTime

Available on crate feature std only.
Source§

fn partial_cmp(&self, other: &Timestamp) -> 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§

#[doc(hidden)]
fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
If self == other, returns ControlFlow::Continue(()). Otherwise, returns ControlFlow::Break(self < other). Read more
Source§

#[doc(hidden)]
fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for <= instead of <.
Source§

#[doc(hidden)]
fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for > instead of <.
Source§

#[doc(hidden)]
fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for >= instead of <.
Source§

impl PartialOrd<Timestamp> for UtcDateTime

Source§

fn partial_cmp(&self, other: &Timestamp) -> 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§

#[doc(hidden)]
fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
If self == other, returns ControlFlow::Continue(()). Otherwise, returns ControlFlow::Break(self < other). Read more
Source§

#[doc(hidden)]
fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for <= instead of <.
Source§

#[doc(hidden)]
fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for > instead of <.
Source§

#[doc(hidden)]
fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for >= instead of <.
Source§

impl PartialOrd<UtcDateTime> for Timestamp

Source§

fn partial_cmp(&self, other: &UtcDateTime) -> 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§

#[doc(hidden)]
fn __chaining_lt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
If self == other, returns ControlFlow::Continue(()). Otherwise, returns ControlFlow::Break(self < other). Read more
Source§

#[doc(hidden)]
fn __chaining_le(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for <= instead of <.
Source§

#[doc(hidden)]
fn __chaining_gt(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for > instead of <.
Source§

#[doc(hidden)]
fn __chaining_ge(&self, other: &Rhs) -> ControlFlow<bool>

🔬This is a nightly-only experimental API. (partial_ord_chaining_methods)
Same as __chaining_lt, but for >= instead of <.
Source§

impl Serialize for Timestamp

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub for Timestamp

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Duration> for Timestamp

Source§

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

§Panics

This may panic if an overflow occurs.

Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

impl Sub<Duration> for Timestamp

Source§

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

§Panics

This may panic if an overflow occurs.

Source§

type Output = Timestamp

The resulting type after applying the - operator.
Source§

impl Sub<OffsetDateTime> for Timestamp

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<SystemTime> for Timestamp

Available on crate feature std only.
Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Timestamp> for OffsetDateTime

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Timestamp> for SystemTime

Available on crate feature std only.
Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Timestamp> for UtcDateTime

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<UtcDateTime> for Timestamp

Source§

type Output = Duration

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign<Duration> for Timestamp

Source§

fn sub_assign(&mut self, rhs: Duration)

§Panics

This may panic if an overflow occurs.

Source§

impl SubAssign<Duration> for Timestamp

Source§

fn sub_assign(&mut self, rhs: StdDuration)

§Panics

This may panic if an overflow occurs.

Source§

impl TrivialClone for Timestamp

Source§

impl TryFrom<Parsed> for Timestamp

Available on crate feature parsing only.
Source§

type Error = TryFromParsed

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

fn try_from(parsed: Parsed) -> Result<Self, Self::Error>

Performs the conversion.

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Printable for T
where T: Copy + Debug,

Source§

impl<T> SizedTypeProperties for T

Source§

#[doc(hidden)]
const SIZE: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGNMENT: Alignment = _

🔬This is a nightly-only experimental API. (ptr_alignment_type)
Source§

#[doc(hidden)]
const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)]
const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const MAX_SLICE_LEN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
The largest safe length for a [Self]. Read more
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.