Skip to main content

Ticks

Struct Ticks 

Source
pub struct Ticks(/* private fields */);
Expand description

A signed 128-bit nanosecond instant since 1970-01-01T00:00:00Z.

Implementations§

Source§

impl Ticks

Source

pub const EPOCH: Ticks

The Unix epoch itself: 1970-01-01T00:00:00Z.

Source

pub const MIN: Ticks

The smallest representable instant.

Source

pub const MAX: Ticks

The largest representable instant.

Source

pub const fn from_unix_nanos(nanos: i128) -> Ticks

Build an instant from raw nanoseconds since the Unix epoch.

Source

pub const fn from_unix_seconds(seconds: i64, nanos: u32) -> Result<Ticks>

Build an instant from whole seconds plus sub-second nanoseconds.

nanos must be in 0..1_000_000_000.

Source

pub fn from_timestamp(seconds: i64, nanos: u32) -> Result<Ticks>

Build from a Unix timestamp (chrono’s DateTime::from_timestamp).

nanos must be in 0..1_000_000_000.

Source

pub fn from_timestamp_millis(millis: i64) -> Result<Ticks>

Build from a Unix millisecond timestamp.

Source

pub fn from_timestamp_micros(micros: i64) -> Result<Ticks>

Build from a Unix microsecond timestamp.

Source

pub const fn from_timestamp_nanos(nanos: i128) -> Ticks

Build from a Unix nanosecond timestamp.

Source

pub fn timestamp(self) -> Result<i64>

Whole seconds since the epoch, flooring (the mathematically correct Unix time; chrono truncates toward zero for pre-epoch instants).

Source

pub fn timestamp_millis(self) -> Result<i64>

Whole milliseconds since the epoch, flooring.

Source

pub fn timestamp_micros(self) -> Result<i64>

Whole microseconds since the epoch, flooring.

Source

pub fn timestamp_nanos(self) -> Result<i64>

Nanoseconds since the epoch as i64; fails beyond the i64 range.

Source

pub const fn as_unix_nanos(self) -> i128

Raw nanoseconds since the Unix epoch.

Source

pub fn to_unix_seconds(self) -> Result<(i64, u32)>

Decompose into whole seconds (floor) and sub-second nanoseconds.

The (i64 seconds, u32 nanoseconds) pair is the same shape that chrono, time and rustix build instants from — a pure numeric accessor, with no dependency on any of those crates. Fails only for instants whose day count exceeds i64, i.e. roughly outside ±2.9 billion years.

Examples found in repository?
examples/bench.rs (line 45)
27fn main() {
28    let d = Date::from_ymd(2024, 6, 15).unwrap();
29    let t = TimeOfDay::from_hms_nano(8, 30, 0, 123_456_789).unwrap();
30    let dt = CivilDateTime::new(d, t);
31    let ticks = Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z").unwrap();
32    let span = Duration::from_nanos(123_456_789_123);
33    let mut out = [0u8; 64];
34
35    bench("date civil projection (parts)", 1_000_000, || {
36        black_box(black_box(d).parts());
37    });
38    bench("date weekday", 1_000_000, || {
39        black_box(black_box(d).weekday());
40    });
41    bench("ticks -> civil utc", 1_000_000, || {
42        let _ = black_box(black_box(ticks).to_civil_utc());
43    });
44    bench("ticks -> unix seconds", 1_000_000, || {
45        let _ = black_box(black_box(ticks).to_unix_seconds());
46    });
47    bench("civil -> ticks utc", 1_000_000, || {
48        let _ = black_box(black_box(dt).to_ticks_utc());
49    });
50    bench("ticks checked_add duration", 1_000_000, || {
51        let _ = black_box(black_box(ticks).checked_add(black_box(span)));
52    });
53    bench("parse RFC 3339", 200_000, || {
54        let _ = black_box(Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z"));
55    });
56    bench("format RFC 3339 (buffer)", 200_000, || {
57        let _ = black_box(black_box(ticks).write_rfc3339(&mut out, tzcraft::FractionDigits::Auto));
58    });
59    bench("format strftime (buffer)", 200_000, || {
60        let _ = black_box(black_box(ticks).write_format("%Y-%m-%d %H:%M:%S%.f", &mut out));
61    });
62    bench("parse ISO 8601 duration", 200_000, || {
63        let _ = black_box(Duration::from_iso8601("P1DT2H3M4.5S"));
64    });
65}
Source

pub fn to_timespec(self) -> Result<(i64, i64)>

POSIX-timespec-shaped decomposition: (seconds, nanoseconds) as signed 64-bit values (the same layout as struct timespec on Unix, and therefore the shape rustix’s Timespec uses).

Fails only when the whole-second count exceeds i64 (≈ ±292 billion years); the nanosecond component is always in 0..1_000_000_000.

Source

pub fn from_timespec(seconds: i64, nanos: i64) -> Result<Ticks>

Build from a POSIX-timespec-shaped (seconds, nanoseconds) pair.

nanos must be in 0..1_000_000_000; any other value is rejected (POSIX timespec normalization is not silently applied).

Source

pub fn now() -> Result<Ticks>

Available on crate feature std only.

The current wall-clock instant (requires the std feature).

Source

pub fn to_std_time(self) -> Result<SystemTime>

Available on crate feature std only.

Convert to a std::time::SystemTime (requires the std feature).

Fails for instants before the Unix epoch (unrepresentable).

Source

pub fn checked_add(self, delta: Duration) -> Result<Ticks>

Checked addition of a signed duration.

Examples found in repository?
examples/bench.rs (line 51)
27fn main() {
28    let d = Date::from_ymd(2024, 6, 15).unwrap();
29    let t = TimeOfDay::from_hms_nano(8, 30, 0, 123_456_789).unwrap();
30    let dt = CivilDateTime::new(d, t);
31    let ticks = Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z").unwrap();
32    let span = Duration::from_nanos(123_456_789_123);
33    let mut out = [0u8; 64];
34
35    bench("date civil projection (parts)", 1_000_000, || {
36        black_box(black_box(d).parts());
37    });
38    bench("date weekday", 1_000_000, || {
39        black_box(black_box(d).weekday());
40    });
41    bench("ticks -> civil utc", 1_000_000, || {
42        let _ = black_box(black_box(ticks).to_civil_utc());
43    });
44    bench("ticks -> unix seconds", 1_000_000, || {
45        let _ = black_box(black_box(ticks).to_unix_seconds());
46    });
47    bench("civil -> ticks utc", 1_000_000, || {
48        let _ = black_box(black_box(dt).to_ticks_utc());
49    });
50    bench("ticks checked_add duration", 1_000_000, || {
51        let _ = black_box(black_box(ticks).checked_add(black_box(span)));
52    });
53    bench("parse RFC 3339", 200_000, || {
54        let _ = black_box(Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z"));
55    });
56    bench("format RFC 3339 (buffer)", 200_000, || {
57        let _ = black_box(black_box(ticks).write_rfc3339(&mut out, tzcraft::FractionDigits::Auto));
58    });
59    bench("format strftime (buffer)", 200_000, || {
60        let _ = black_box(black_box(ticks).write_format("%Y-%m-%d %H:%M:%S%.f", &mut out));
61    });
62    bench("parse ISO 8601 duration", 200_000, || {
63        let _ = black_box(Duration::from_iso8601("P1DT2H3M4.5S"));
64    });
65}
Source

pub fn checked_sub(self, delta: Duration) -> Result<Ticks>

Checked subtraction of a signed duration.

Source

pub fn checked_add_signed(self, rhs: Duration) -> Result<Ticks>

Alias for Ticks::checked_add (chrono-compatible name).

Source

pub fn checked_sub_signed(self, rhs: Duration) -> Result<Ticks>

Alias for Ticks::checked_sub (chrono-compatible name).

Source

pub fn checked_add_days(self, days: Days) -> Result<Ticks>

Checked day offset.

Source

pub fn checked_sub_days(self, days: Days) -> Result<Ticks>

Checked day offset in the negative direction.

Source

pub fn saturating_add(self, delta: Duration) -> Ticks

Saturating addition of a signed duration.

Source

pub fn saturating_sub(self, delta: Duration) -> Ticks

Saturating subtraction of a signed duration.

Source

pub fn duration_since(self, earlier: Ticks) -> Duration

The signed duration between earlier and self.

Saturates at the representable boundary instead of overflowing: MAX - MIN would wrap in release and panic in debug.

Source

pub fn checked_add_months(self, months: Months) -> Result<Ticks>

Calendar-aware month stepping on the UTC civil projection.

The day is clamped to the end of the target month (2023-01-31 + 1 month = 2023-02-28).

Source

pub fn checked_sub_months(self, months: Months) -> Result<Ticks>

Calendar-aware month stepping in the negative direction.

Source

pub fn checked_add_years(self, years: i32) -> Result<Ticks>

Calendar-aware year stepping (see Ticks::checked_add_months).

Source

pub fn to_civil_utc(self) -> Result<CivilDateTime>

The UTC civil projection (date, time-of-day).

Fails only for instants whose day count exceeds i64.

Examples found in repository?
examples/bench.rs (line 42)
27fn main() {
28    let d = Date::from_ymd(2024, 6, 15).unwrap();
29    let t = TimeOfDay::from_hms_nano(8, 30, 0, 123_456_789).unwrap();
30    let dt = CivilDateTime::new(d, t);
31    let ticks = Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z").unwrap();
32    let span = Duration::from_nanos(123_456_789_123);
33    let mut out = [0u8; 64];
34
35    bench("date civil projection (parts)", 1_000_000, || {
36        black_box(black_box(d).parts());
37    });
38    bench("date weekday", 1_000_000, || {
39        black_box(black_box(d).weekday());
40    });
41    bench("ticks -> civil utc", 1_000_000, || {
42        let _ = black_box(black_box(ticks).to_civil_utc());
43    });
44    bench("ticks -> unix seconds", 1_000_000, || {
45        let _ = black_box(black_box(ticks).to_unix_seconds());
46    });
47    bench("civil -> ticks utc", 1_000_000, || {
48        let _ = black_box(black_box(dt).to_ticks_utc());
49    });
50    bench("ticks checked_add duration", 1_000_000, || {
51        let _ = black_box(black_box(ticks).checked_add(black_box(span)));
52    });
53    bench("parse RFC 3339", 200_000, || {
54        let _ = black_box(Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z"));
55    });
56    bench("format RFC 3339 (buffer)", 200_000, || {
57        let _ = black_box(black_box(ticks).write_rfc3339(&mut out, tzcraft::FractionDigits::Auto));
58    });
59    bench("format strftime (buffer)", 200_000, || {
60        let _ = black_box(black_box(ticks).write_format("%Y-%m-%d %H:%M:%S%.f", &mut out));
61    });
62    bench("parse ISO 8601 duration", 200_000, || {
63        let _ = black_box(Duration::from_iso8601("P1DT2H3M4.5S"));
64    });
65}
Source

pub fn date_utc(self) -> Result<Date>

The UTC civil date.

Source

pub fn time_utc(self) -> Result<TimeOfDay>

The UTC civil time-of-day.

Source

pub fn weekday_utc(self) -> Result<Weekday>

The UTC weekday.

Source

pub fn to_zoned(self, zone: Zone) -> Zoned

Attach a zone without shifting the instant.

Source

pub fn to_rfc3339(self, fraction: FractionDigits) -> String

Available on crate feature alloc only.

RFC 3339 rendering with the requested fractional-second precision.

The canonical form carries the Z designator. Instants beyond the civil i64 day range (≈ ±2.9 billion years) fall back to a raw nanosecond count followed by s.

This method allocates. The allocator-free equivalent is Ticks::write_rfc3339.

Source

pub fn write_rfc3339( self, out: &mut [u8], fraction: FractionDigits, ) -> Result<usize>

RFC 3339 rendering into a caller-owned buffer (allocator-free).

Returns the number of bytes written. A 64-byte buffer is always large enough; Error::buffer_overflow is returned when it is not.

Examples found in repository?
examples/bench.rs (line 57)
27fn main() {
28    let d = Date::from_ymd(2024, 6, 15).unwrap();
29    let t = TimeOfDay::from_hms_nano(8, 30, 0, 123_456_789).unwrap();
30    let dt = CivilDateTime::new(d, t);
31    let ticks = Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z").unwrap();
32    let span = Duration::from_nanos(123_456_789_123);
33    let mut out = [0u8; 64];
34
35    bench("date civil projection (parts)", 1_000_000, || {
36        black_box(black_box(d).parts());
37    });
38    bench("date weekday", 1_000_000, || {
39        black_box(black_box(d).weekday());
40    });
41    bench("ticks -> civil utc", 1_000_000, || {
42        let _ = black_box(black_box(ticks).to_civil_utc());
43    });
44    bench("ticks -> unix seconds", 1_000_000, || {
45        let _ = black_box(black_box(ticks).to_unix_seconds());
46    });
47    bench("civil -> ticks utc", 1_000_000, || {
48        let _ = black_box(black_box(dt).to_ticks_utc());
49    });
50    bench("ticks checked_add duration", 1_000_000, || {
51        let _ = black_box(black_box(ticks).checked_add(black_box(span)));
52    });
53    bench("parse RFC 3339", 200_000, || {
54        let _ = black_box(Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z"));
55    });
56    bench("format RFC 3339 (buffer)", 200_000, || {
57        let _ = black_box(black_box(ticks).write_rfc3339(&mut out, tzcraft::FractionDigits::Auto));
58    });
59    bench("format strftime (buffer)", 200_000, || {
60        let _ = black_box(black_box(ticks).write_format("%Y-%m-%d %H:%M:%S%.f", &mut out));
61    });
62    bench("parse ISO 8601 duration", 200_000, || {
63        let _ = black_box(Duration::from_iso8601("P1DT2H3M4.5S"));
64    });
65}
Source

pub fn from_rfc3339(s: &str) -> Result<Ticks>

Parse a full RFC 3339 timestamp, normalizing to UTC.

Accepts T/t/space separators, fractional seconds of 1..9 digits, and offsets in Z, ±HH:MM, ±HHMM or ±HH form.

Examples found in repository?
examples/bench.rs (line 31)
27fn main() {
28    let d = Date::from_ymd(2024, 6, 15).unwrap();
29    let t = TimeOfDay::from_hms_nano(8, 30, 0, 123_456_789).unwrap();
30    let dt = CivilDateTime::new(d, t);
31    let ticks = Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z").unwrap();
32    let span = Duration::from_nanos(123_456_789_123);
33    let mut out = [0u8; 64];
34
35    bench("date civil projection (parts)", 1_000_000, || {
36        black_box(black_box(d).parts());
37    });
38    bench("date weekday", 1_000_000, || {
39        black_box(black_box(d).weekday());
40    });
41    bench("ticks -> civil utc", 1_000_000, || {
42        let _ = black_box(black_box(ticks).to_civil_utc());
43    });
44    bench("ticks -> unix seconds", 1_000_000, || {
45        let _ = black_box(black_box(ticks).to_unix_seconds());
46    });
47    bench("civil -> ticks utc", 1_000_000, || {
48        let _ = black_box(black_box(dt).to_ticks_utc());
49    });
50    bench("ticks checked_add duration", 1_000_000, || {
51        let _ = black_box(black_box(ticks).checked_add(black_box(span)));
52    });
53    bench("parse RFC 3339", 200_000, || {
54        let _ = black_box(Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z"));
55    });
56    bench("format RFC 3339 (buffer)", 200_000, || {
57        let _ = black_box(black_box(ticks).write_rfc3339(&mut out, tzcraft::FractionDigits::Auto));
58    });
59    bench("format strftime (buffer)", 200_000, || {
60        let _ = black_box(black_box(ticks).write_format("%Y-%m-%d %H:%M:%S%.f", &mut out));
61    });
62    bench("parse ISO 8601 duration", 200_000, || {
63        let _ = black_box(Duration::from_iso8601("P1DT2H3M4.5S"));
64    });
65}
Source

pub fn format(self, fmt: &str) -> Result<String>

Available on crate feature alloc only.

strftime-style rendering, e.g. t.format("%Y-%m-%d %H:%M:%S %z").

The civil parts are UTC and the offset designator is Z. Supported directives: %Y %y %C %m %d %e %j %H %I %k %l %M %S %f %.f %.3f %p %P %a %A %b %h %B %G %g %V %u %w %U %W %z %:z %Z %s %F %D %x %R %T %X %r %+ %n %t %%, plus the %-/%_/%0 padding modifiers.

This method allocates. The allocator-free equivalent is Ticks::write_format.

Source

pub fn write_format(self, fmt: &str, out: &mut [u8]) -> Result<usize>

strftime-style rendering into a caller-owned buffer (allocator-free).

Examples found in repository?
examples/bench.rs (line 60)
27fn main() {
28    let d = Date::from_ymd(2024, 6, 15).unwrap();
29    let t = TimeOfDay::from_hms_nano(8, 30, 0, 123_456_789).unwrap();
30    let dt = CivilDateTime::new(d, t);
31    let ticks = Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z").unwrap();
32    let span = Duration::from_nanos(123_456_789_123);
33    let mut out = [0u8; 64];
34
35    bench("date civil projection (parts)", 1_000_000, || {
36        black_box(black_box(d).parts());
37    });
38    bench("date weekday", 1_000_000, || {
39        black_box(black_box(d).weekday());
40    });
41    bench("ticks -> civil utc", 1_000_000, || {
42        let _ = black_box(black_box(ticks).to_civil_utc());
43    });
44    bench("ticks -> unix seconds", 1_000_000, || {
45        let _ = black_box(black_box(ticks).to_unix_seconds());
46    });
47    bench("civil -> ticks utc", 1_000_000, || {
48        let _ = black_box(black_box(dt).to_ticks_utc());
49    });
50    bench("ticks checked_add duration", 1_000_000, || {
51        let _ = black_box(black_box(ticks).checked_add(black_box(span)));
52    });
53    bench("parse RFC 3339", 200_000, || {
54        let _ = black_box(Ticks::from_rfc3339("2024-06-15T08:30:00.123456789Z"));
55    });
56    bench("format RFC 3339 (buffer)", 200_000, || {
57        let _ = black_box(black_box(ticks).write_rfc3339(&mut out, tzcraft::FractionDigits::Auto));
58    });
59    bench("format strftime (buffer)", 200_000, || {
60        let _ = black_box(black_box(ticks).write_format("%Y-%m-%d %H:%M:%S%.f", &mut out));
61    });
62    bench("parse ISO 8601 duration", 200_000, || {
63        let _ = black_box(Duration::from_iso8601("P1DT2H3M4.5S"));
64    });
65}
Source

pub fn parse_from_str(s: &str, fmt: &str) -> Result<Ticks>

Parse with a strftime-style format string (chrono’s DateTime::parse_from_str); the civil path requires a timezone offset.

Source

pub fn to_rfc2822(self) -> String

Available on crate feature alloc only.

RFC 2822 rendering in UTC (email / HTTP header dates).

This method allocates. The allocator-free equivalent is Ticks::write_rfc2822.

Source

pub fn write_rfc2822(self, out: &mut [u8]) -> Result<usize>

RFC 2822 rendering into a caller-owned buffer (allocator-free).

Source

pub fn from_rfc2822(s: &str) -> Result<Ticks>

Parse an RFC 2822 date-time, normalizing to UTC.

Trait Implementations§

Source§

impl Clone for Ticks

Source§

fn clone(&self) -> Ticks

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 Copy for Ticks

Source§

impl Debug for Ticks

Source§

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

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

impl Display for Ticks

Source§

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

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

impl Eq for Ticks

Source§

impl FromStr for Ticks

Source§

type Err = Error

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

fn from_str(s: &str) -> Result<Ticks>

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

impl Hash for Ticks

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<'de> NsonDeserialize<'de> for Ticks

Available on crate feature serde only.
Source§

fn nextdecode_into<D: FormatDecoder<'de>>( dec: &mut D, out: &mut DecodeSlot<Self>, ) -> Result<(), D::Error>

Decode into out. Read more
Source§

fn expecting() -> &'static str

Human-readable description of the value this type decodes from. Read more
Source§

fn nextdecode<D>( decoder: &mut D, ) -> Result<Self, <D as FormatDecoder<'de>>::Error>
where D: FormatDecoder<'de>,

Decode and return a value.
Source§

impl NsonSchema for Ticks

Available on crate feature serde only.
Source§

const SCHEMA: TypeSchema = TypeSchema::Str

The compile-time structural description.
Source§

impl NsonSerialize for Ticks

Available on crate feature serde only.
Source§

fn nextencode<E: FormatEncoder>(&self, enc: &mut E) -> Result<(), E::Error>

Next-encode self into encoder. Read more
Source§

impl Ord for Ticks

Source§

fn cmp(&self, other: &Ticks) -> 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 Ticks

Source§

fn eq(&self, other: &Ticks) -> 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 Ticks

Source§

fn partial_cmp(&self, other: &Ticks) -> 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 StructuralPartialEq for Ticks

Auto Trait Implementations§

§

impl Freeze for Ticks

§

impl RefUnwindSafe for Ticks

§

impl Send for Ticks

§

impl Sync for Ticks

§

impl Unpin for Ticks

§

impl UnsafeUnpin for Ticks

§

impl UnwindSafe for Ticks

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

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.