Skip to main content

Timed

Struct Timed 

Source
#[repr(C)]
pub struct Timed<T, S = Timestamp> { pub stamp: S, pub value: T, }
Expand description

A value T and the stamp S its writer captured it with.

The stamp comes from the writer: by the time a reader holds the value the moment has gone, and a clock read on the reading side would time the reader. The stamp comes first, so the derived order is chronological, and the value is reached through Deref.

§Examples

use t2t_core::{Timed, Timedelta, Timestamp};

let captured = Timestamp::from_secs(1_700_000_000);
let sample = Timed::new(captured, 101_u64);

assert_eq!(*sample, 101, "the value, through `Deref`");
let now = captured + Timedelta::from_millis(5);
assert_eq!(sample.elapsed(now), Timedelta::from_millis(5), "its age");

Fields§

§stamp: S

When the value was captured.

§value: T

What was captured.

Implementations§

Source§

impl<T, S> Timed<T, S>

Source

pub const fn new(stamp: S, value: T) -> Timed<T, S>

value, captured at stamp.

Examples found in repository?
examples/time-tour.rs (line 43)
20fn main() {
21    // A span is written and read the way a config spells it.
22    let stale = Timedelta::SECOND;
23    println!("stale after        {stale}");
24    println!("\"1h30m\" reads as   {:?}", "1h30m".parse::<Timedelta>());
25
26    // An instant is a point; the difference of two is a span.
27    let published = Timestamp::from_secs(1_700_000_000);
28    let captured = published + Timedelta::from_micros(850);
29    println!("published          {published}");
30    println!("captured           {captured:.6}");
31    println!("on the wire        {}", captured - published);
32
33    // The same instant, read as a date; and the minute it falls in.
34    let date_time = captured.to_utc();
35    println!(
36        "that is            {}-{:02}-{:02}, {} ns past the second",
37        date_time.year, date_time.month, date_time.day, date_time.nanosecond
38    );
39    let minute = captured.floor(Timedelta::MINUTE);
40    println!("its minute         {minute:.0} to {:.0}", minute + Timedelta::MINUTE);
41
42    // A value carries the stamp its writer captured it with, and says how old it is.
43    let sample = Timed::new(captured, Weather { celsius: 21, humidity: 40 });
44    let age = sample.elapsed(captured + Timedelta::from_millis(1_500));
45    println!(
46        "sample             {} °C, {}%, {age} old, stale: {}",
47        sample.celsius,
48        sample.humidity,
49        age > stale
50    );
51
52    // A counter's ticks mean nothing until a rate says what one is worth.
53    let start = Tickstamp::from_ticks(1_000_000);
54    let ticks = start + Tickdelta::from_ticks(4_250) - start;
55    let rate = TickRate::GIGAHERTZ;
56    println!("counter ran        {ticks}: {} at {rate}", ticks.to_timedelta(rate));
57}
Source

pub fn into_inner(self) -> T

The value, without its stamp.

Source

pub fn into_parts(self) -> (S, T)

The stamp and the value.

Source

pub fn map<U, F>(self, transform: F) -> Timed<U, S>
where F: FnOnce(T) -> U,

The same stamp over a value made from this one.

Source

pub fn map_stamp<R, F>(self, transform: F) -> Timed<T, R>
where F: FnOnce(S) -> R,

The same value under a stamp made from this one.

Source§

impl<T, S> Timed<T, S>
where S: Copy,

Source

pub const fn as_ref(&self) -> Timed<&T, S>

The same stamp over a borrow of the value.

Source

pub const fn as_mut(&mut self) -> Timed<&mut T, S>

The same stamp over a mutable borrow of the value.

Source§

impl<T, S> Timed<T, S>
where S: TimePoint,

Source

pub fn elapsed(&self, now: S) -> <S as TimePoint>::Span

The span from capture to now, negative for a stamp still ahead.

Examples found in repository?
examples/time-tour.rs (line 44)
20fn main() {
21    // A span is written and read the way a config spells it.
22    let stale = Timedelta::SECOND;
23    println!("stale after        {stale}");
24    println!("\"1h30m\" reads as   {:?}", "1h30m".parse::<Timedelta>());
25
26    // An instant is a point; the difference of two is a span.
27    let published = Timestamp::from_secs(1_700_000_000);
28    let captured = published + Timedelta::from_micros(850);
29    println!("published          {published}");
30    println!("captured           {captured:.6}");
31    println!("on the wire        {}", captured - published);
32
33    // The same instant, read as a date; and the minute it falls in.
34    let date_time = captured.to_utc();
35    println!(
36        "that is            {}-{:02}-{:02}, {} ns past the second",
37        date_time.year, date_time.month, date_time.day, date_time.nanosecond
38    );
39    let minute = captured.floor(Timedelta::MINUTE);
40    println!("its minute         {minute:.0} to {:.0}", minute + Timedelta::MINUTE);
41
42    // A value carries the stamp its writer captured it with, and says how old it is.
43    let sample = Timed::new(captured, Weather { celsius: 21, humidity: 40 });
44    let age = sample.elapsed(captured + Timedelta::from_millis(1_500));
45    println!(
46        "sample             {} °C, {}%, {age} old, stale: {}",
47        sample.celsius,
48        sample.humidity,
49        age > stale
50    );
51
52    // A counter's ticks mean nothing until a rate says what one is worth.
53    let start = Tickstamp::from_ticks(1_000_000);
54    let ticks = start + Tickdelta::from_ticks(4_250) - start;
55    let rate = TickRate::GIGAHERTZ;
56    println!("counter ran        {ticks}: {} at {rate}", ticks.to_timedelta(rate));
57}

Trait Implementations§

Source§

impl<T, S> Clone for Timed<T, S>
where T: Clone, S: Clone,

Source§

fn clone(&self) -> Timed<T, S>

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<T, S> Copy for Timed<T, S>
where T: Copy, S: Copy,

Source§

impl<T, S> Debug for Timed<T, S>
where T: Debug, S: Debug,

Source§

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

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

impl<T, S> Default for Timed<T, S>
where T: Default, S: Default,

Source§

fn default() -> Timed<T, S>

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

impl<T, S> Deref for Timed<T, S>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Timed<T, S> as Deref>::Target

Dereferences the value.
Source§

impl<T, S> DerefMut for Timed<T, S>

Source§

fn deref_mut(&mut self) -> &mut <Timed<T, S> as Deref>::Target

Mutably dereferences the value.
Source§

impl<T, S> Eq for Timed<T, S>
where T: Eq, S: Eq,

Source§

impl<T, S> From<(S, T)> for Timed<T, S>

Source§

fn from(value: (S, T)) -> Timed<T, S>

Converts to this type from the input type.
Source§

impl<T, S> FromBytes for Timed<T, S>
where S: FromBytes, T: FromBytes,

Source§

fn ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>
where Self: KnownLayout + Immutable,

Interprets the given source as a &Self. Read more
Source§

fn ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>
where Self: KnownLayout + Immutable,

Interprets the prefix of the given source as a &Self without copying. Read more
Source§

fn ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>
where Self: Immutable + KnownLayout,

Interprets the suffix of the given bytes as a &Self. Read more
Source§

fn mut_from_bytes( source: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>
where Self: IntoBytes + KnownLayout,

Interprets the given source as a &mut Self. Read more
Source§

fn mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>
where Self: IntoBytes + KnownLayout,

Interprets the prefix of the given source as a &mut Self without copying. Read more
Source§

fn mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>
where Self: IntoBytes + KnownLayout,

Interprets the suffix of the given source as a &mut Self without copying. Read more
Source§

fn ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &Self with a DST length equal to count. Read more
Source§

fn ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the prefix of the given source as a DST &Self with length equal to count. Read more
Source§

fn ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the suffix of the given source as a DST &Self with length equal to count. Read more
Source§

fn mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize> + Immutable,

Interprets the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the prefix of the given source as a &mut Self with DST length equal to count. Read more
Source§

fn mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>
where Self: IntoBytes + KnownLayout<PointerMetadata = usize>,

Interprets the suffix of the given source as a &mut Self with DST length equal to count. Read more
Source§

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source. Read more
Source§

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source. Read more
Source§

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source. Read more
Source§

fn read_from_io<R>(src: R) -> Result<Self, Error>
where Self: Sized, R: Read,

Available on crate feature std only.
Reads a copy of self from an io::Read. Read more
Source§

impl<T, S> FromZeros for Timed<T, S>
where S: FromZeros, T: FromZeros,

Source§

fn zero(&mut self)

Overwrites self with zeros. Read more
Source§

fn new_zeroed() -> Self
where Self: Sized,

Creates an instance of Self from zeroed bytes. Read more
Source§

fn new_box_zeroed() -> Result<Box<Self>, AllocError>
where Self: Sized,

Available on crate features alloc only.
Creates a Box<Self> from zeroed bytes. Read more
Source§

fn new_box_zeroed_with_elems(count: usize) -> Result<Box<Self>, AllocError>
where Self: KnownLayout<PointerMetadata = usize>,

Available on crate feature alloc only.
Creates a Box<[Self]> (a boxed slice) from zeroed bytes. Read more
Source§

fn new_vec_zeroed(len: usize) -> Result<Vec<Self>, AllocError>
where Self: Sized,

Available on crate feature alloc only.
Creates a Vec<Self> from zeroed bytes. Read more
Source§

fn extend_vec_zeroed( v: &mut Vec<Self>, additional: usize, ) -> Result<(), AllocError>
where Self: Sized,

Available on crate feature alloc and non-no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0 only.
Extends a Vec<Self> by pushing additional new items onto the end of the vector. The new items are initialized with zeros.
Source§

fn insert_vec_zeroed( v: &mut Vec<Self>, position: usize, additional: usize, ) -> Result<(), AllocError>
where Self: Sized,

Available on crate feature alloc and non-no_zerocopy_panic_in_const_and_vec_try_reserve_1_57_0 only.
Inserts additional new items into Vec<Self> at position. The new items are initialized with zeros. Read more
Source§

impl<T, S> Hash for Timed<T, S>
where T: Hash, S: Hash,

Source§

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

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<T, S> Immutable for Timed<T, S>
where S: Immutable, T: Immutable,

Source§

impl<T, S> KnownLayout for Timed<T, S>
where T: KnownLayout,

Source§

type PointerMetadata = <T as KnownLayout>::PointerMetadata

The type of metadata stored in a pointer to Self. Read more
Source§

fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>

Computes the size of an object of type Self with the given pointer metadata. Read more
Source§

impl<T, S> Ord for Timed<T, S>
where T: Ord, S: Ord,

Source§

fn cmp(&self, other: &Timed<T, S>) -> 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<T, S> PartialEq for Timed<T, S>
where T: PartialEq, S: PartialEq,

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl<T, S> PartialOrd for Timed<T, S>
where T: PartialOrd, S: PartialOrd,

Source§

fn partial_cmp(&self, other: &Timed<T, S>) -> 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<T, S> StructuralPartialEq for Timed<T, S>
where T: PartialEq, S: PartialEq,

Source§

impl<T, S> TryFromBytes for Timed<T, S>

Source§

fn try_ref_from_bytes( source: &[u8], ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the given source as a &Self. Read more
Source§

fn try_ref_from_prefix( source: &[u8], ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the prefix of the given source as a &Self. Read more
Source§

fn try_ref_from_suffix( source: &[u8], ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout + Immutable,

Attempts to interpret the suffix of the given source as a &Self. Read more
Source§

fn try_mut_from_bytes( bytes: &mut [u8], ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the given source as a &mut Self without copying. Read more
Source§

fn try_mut_from_prefix( source: &mut [u8], ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self. Read more
Source§

fn try_mut_from_suffix( source: &mut [u8], ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self. Read more
Source§

fn try_ref_from_bytes_with_elems( source: &[u8], count: usize, ) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the given source as a &Self with a DST length equal to count. Read more
Source§

fn try_ref_from_prefix_with_elems( source: &[u8], count: usize, ) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the prefix of the given source as a &Self with a DST length equal to count. Read more
Source§

fn try_ref_from_suffix_with_elems( source: &[u8], count: usize, ) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + Immutable,

Attempts to interpret the suffix of the given source as a &Self with a DST length equal to count. Read more
Source§

fn try_mut_from_bytes_with_elems( source: &mut [u8], count: usize, ) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_mut_from_prefix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the prefix of the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_mut_from_suffix_with_elems( source: &mut [u8], count: usize, ) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, ValidityError<&mut [u8], Self>>>
where Self: KnownLayout<PointerMetadata = usize> + IntoBytes,

Attempts to interpret the suffix of the given source as a &mut Self with a DST length equal to count. Read more
Source§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<!, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
Source§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<!, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
Source§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<!, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more

Auto Trait Implementations§

§

impl<T, S> Freeze for Timed<T, S>
where S: Freeze, T: Freeze,

§

impl<T, S> RefUnwindSafe for Timed<T, S>

§

impl<T, S> Send for Timed<T, S>
where S: Send, T: Send,

§

impl<T, S> Sync for Timed<T, S>
where S: Sync, T: Sync,

§

impl<T, S> Unpin for Timed<T, S>
where S: Unpin, T: Unpin,

§

impl<T, S> UnsafeUnpin for Timed<T, S>
where S: UnsafeUnpin, T: UnsafeUnpin,

§

impl<T, S> UnwindSafe for Timed<T, S>
where S: UnwindSafe, T: 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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<A, T> Read<A, BecauseImmutable> for T
where A: Aliasing, T: Immutable + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Target = T

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

impl<T> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.