DateTime

Struct DateTime 

Source
#[repr(transparent)]
pub struct DateTime<U = Nanosecond>(pub i64, _) where U: TimeUnitTrait;
Expand description

Represents a date and time with a specific time unit precision.

§Type Parameters

  • U: The time unit precision, defaulting to Nanosecond. Must implement TimeUnitTrait.

§Fields

  • 0: An i64 representing the timestamp in the specified time unit.
  • PhantomData<U>: A zero-sized type used to “mark” the time unit without affecting the struct’s memory layout.

Tuple Fields§

§0: i64

Implementations§

Source§

impl<U> DateTime<U>
where U: TimeUnitTrait,

Source

pub const fn new(dt: i64) -> DateTime<U>

Creates a new DateTime instance with the given timestamp.

§Arguments
  • dt - An i64 representing the timestamp in the specified time unit.
§Returns

A new DateTime<U> instance.

Source

pub const fn is_nat(&self) -> bool

Checks if the DateTime instance represents “Not-a-Time” (NaT).

§Returns

true if the instance is NaT, false otherwise.

Source

pub const fn is_not_nat(&self) -> bool

Checks if the DateTime instance represents a valid time (not NaT).

§Returns

true if the instance is not NaT, false otherwise.

Source

pub const fn nat() -> DateTime<U>

Creates a new DateTime instance representing “Not-a-Time” (NaT).

§Returns

A new DateTime<U> instance representing NaT.

Source

pub const fn into_i64(self) -> i64

Converts the DateTime instance to its underlying i64 timestamp.

§Returns

The i64 timestamp value.

Source

pub const fn from_opt_i64(v: Option<i64>) -> DateTime<U>

Creates a DateTime instance from an optional i64 timestamp.

§Arguments
  • v - An Option<i64> representing the timestamp.
§Returns

A new DateTime<U> instance. If v is None, returns NaT.

Source

pub const fn into_opt_i64(self) -> Option<i64>

Converts the DateTime instance to an optional i64 timestamp.

§Returns

Some(i64) if the instance is not NaT, None otherwise.

Source

pub fn to_cr(&self) -> Option<DateTime<Utc>>

👎Deprecated since 0.5.0: use as_cr instead

Converts the DateTime instance to a chrono::DateTime<Utc>.

§Returns

Some(CrDateTime<Utc>) if the conversion is successful, None if the instance is NaT.

Source

pub fn as_cr(&self) -> Option<DateTime<Utc>>

Source

pub fn parse(s: &str, fmt: Option<&str>) -> Result<DateTime<U>, TError>
where DateTime<U>: From<DateTime<Utc>>,

Parses a string into a DateTime instance.

§Arguments
  • s - The string to parse.
  • fmt - An optional format string. If None, tries multiple common formats.
§Returns

A TResult<Self> containing the parsed DateTime or an error.

Source

pub fn strftime(&self, fmt: Option<&str>) -> String

Formats the DateTime instance as a string.

§Arguments
  • fmt - An optional format string. If None, uses “%Y-%m-%d %H:%M:%S.%f”.
§Returns

A formatted string representation of the DateTime.

Source

pub fn duration_trunc(self, duration: TimeDelta) -> DateTime<U>

Truncates the DateTime to a specified duration.

§Arguments
  • duration - A TimeDelta specifying the truncation interval.
§Returns

A new DateTime<U> instance truncated to the specified duration.

Source§

impl<U> DateTime<U>

Source

pub fn time(&self) -> Option<NaiveTime>

Returns the time component of the DateTime as a NaiveTime.

§Returns

Option<NaiveTime>: The time component if the DateTime is valid, or None if it’s NaT.

Source

pub fn year(&self) -> Option<i32>

Returns the year.

§Returns

Option<i32>: The year if the DateTime is valid, or None if it’s NaT.

Source

pub fn day(&self) -> Option<usize>

Returns the day of the month (1-31).

§Returns

Option<usize>: The day of the month if the DateTime is valid, or None if it’s NaT.

Source

pub fn month(&self) -> Option<usize>

Returns the month (1-12).

§Returns

Option<usize>: The month if the DateTime is valid, or None if it’s NaT.

Source

pub fn hour(&self) -> Option<usize>

Returns the hour (0-23).

§Returns

Option<usize>: The hour if the DateTime is valid, or None if it’s NaT.

Source

pub fn minute(&self) -> Option<usize>

Returns the minute (0-59).

§Returns

Option<usize>: The minute if the DateTime is valid, or None if it’s NaT.

Source

pub fn second(&self) -> Option<usize>

Returns the second (0-59).

§Returns

Option<usize>: The second if the DateTime is valid, or None if it’s NaT.

Source§

impl<U> DateTime<U>
where U: TimeUnitTrait,

Source

pub fn into_unit<T>(self) -> DateTime<T>
where T: TimeUnitTrait,

Trait Implementations§

Source§

impl<U> Add<TimeDelta> for DateTime<U>

Source§

type Output = DateTime<U>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: TimeDelta) -> <DateTime<U> as Add<TimeDelta>>::Output

Performs the + operation. Read more
Source§

impl Cast<DateTime<Microsecond>> for DateTime<Nanosecond>

Source§

fn cast(self) -> DateTime<Microsecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Microsecond>> for DateTime<Millisecond>

Source§

fn cast(self) -> DateTime<Microsecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Microsecond>> for DateTime<Second>

Source§

fn cast(self) -> DateTime<Microsecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Millisecond>> for DateTime<Nanosecond>

Source§

fn cast(self) -> DateTime<Millisecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Millisecond>> for DateTime<Microsecond>

Source§

fn cast(self) -> DateTime<Millisecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Millisecond>> for DateTime<Second>

Source§

fn cast(self) -> DateTime<Millisecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Second>> for DateTime<Nanosecond>

Source§

fn cast(self) -> DateTime<Second>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Second>> for DateTime<Microsecond>

Source§

fn cast(self) -> DateTime<Second>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime<Second>> for DateTime<Millisecond>

Source§

fn cast(self) -> DateTime<Second>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for &str

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<bool>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<f32>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<f64>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<i32>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<i64>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<isize>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<u64>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<u8>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for Option<usize>

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for String

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for TimeDelta

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for bool

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for f32

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for f64

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for i32

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for i64

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for isize

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for u64

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for u8

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<DateTime<U>> for usize

Available on crate feature time only.
Source§

fn cast(self) -> DateTime<U>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime> for DateTime<Microsecond>

Source§

fn cast(self) -> DateTime<Nanosecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime> for DateTime<Millisecond>

Source§

fn cast(self) -> DateTime<Nanosecond>

Casts the value to the target type T. Read more
Source§

impl Cast<DateTime> for DateTime<Second>

Source§

fn cast(self) -> DateTime<Nanosecond>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<bool>> for DateTime<U>

Source§

fn cast(self) -> Option<bool>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<f32>> for DateTime<U>

Source§

fn cast(self) -> Option<f32>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<f64>> for DateTime<U>

Source§

fn cast(self) -> Option<f64>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<i32>> for DateTime<U>

Source§

fn cast(self) -> Option<i32>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<i64>> for DateTime<U>

Available on crate feature time only.
Source§

fn cast(self) -> Option<i64>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<isize>> for DateTime<U>

Source§

fn cast(self) -> Option<isize>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<u64>> for DateTime<U>

Source§

fn cast(self) -> Option<u64>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<u8>> for DateTime<U>

Source§

fn cast(self) -> Option<u8>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<Option<usize>> for DateTime<U>

Source§

fn cast(self) -> Option<usize>

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<String> for DateTime<U>

Available on crate feature time only.
Source§

fn cast(self) -> String

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<TimeDelta> for DateTime<U>

Available on crate feature time only.
Source§

fn cast(self) -> TimeDelta

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<bool> for DateTime<U>

Source§

fn cast(self) -> bool

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<f32> for DateTime<U>

Source§

fn cast(self) -> f32

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<f64> for DateTime<U>

Source§

fn cast(self) -> f64

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<i32> for DateTime<U>

Source§

fn cast(self) -> i32

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<i64> for DateTime<U>

Available on crate feature time only.
Source§

fn cast(self) -> i64

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<isize> for DateTime<U>

Source§

fn cast(self) -> isize

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<u64> for DateTime<U>

Source§

fn cast(self) -> u64

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<u8> for DateTime<U>

Source§

fn cast(self) -> u8

Casts the value to the target type T. Read more
Source§

impl<U: TimeUnitTrait> Cast<usize> for DateTime<U>

Source§

fn cast(self) -> usize

Casts the value to the target type T. Read more
Source§

impl<U> Clone for DateTime<U>
where U: Clone + TimeUnitTrait,

Source§

fn clone(&self) -> DateTime<U>

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

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

Performs copy-assignment from source. Read more
Source§

impl<U> Debug for DateTime<U>

Source§

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

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

impl<U> Default for DateTime<U>
where U: TimeUnitTrait,

Source§

fn default() -> DateTime<U>

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

impl From<DateTime<Utc>> for DateTime

Source§

fn from(dt: DateTime<Utc>) -> DateTime

Converts to this type from the input type.
Source§

impl From<DateTime<Utc>> for DateTime<Microsecond>

Source§

fn from(dt: DateTime<Utc>) -> DateTime<Microsecond>

Converts to this type from the input type.
Source§

impl From<DateTime<Utc>> for DateTime<Millisecond>

Source§

fn from(dt: DateTime<Utc>) -> DateTime<Millisecond>

Converts to this type from the input type.
Source§

impl From<DateTime<Utc>> for DateTime<Second>

Source§

fn from(dt: DateTime<Utc>) -> DateTime<Second>

Converts to this type from the input type.
Source§

impl<U> From<NaiveDate> for DateTime<U>

Source§

fn from(dt: NaiveDate) -> DateTime<U>

Converts to this type from the input type.
Source§

impl<U> From<NaiveDateTime> for DateTime<U>

Source§

fn from(dt: NaiveDateTime) -> DateTime<U>

Converts to this type from the input type.
Source§

impl<U> From<Option<NaiveDateTime>> for DateTime<U>

Source§

fn from(dt: Option<NaiveDateTime>) -> DateTime<U>

Converts to this type from the input type.
Source§

impl<U> From<Option<i64>> for DateTime<U>
where U: TimeUnitTrait,

Source§

fn from(dt: Option<i64>) -> DateTime<U>

Converts to this type from the input type.
Source§

impl<U> From<i64> for DateTime<U>
where U: TimeUnitTrait,

Source§

fn from(dt: i64) -> DateTime<U>

Converts to this type from the input type.
Source§

impl<U> FromStr for DateTime<U>

Source§

type Err = TError

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

fn from_str(s: &str) -> Result<DateTime<U>, <DateTime<U> as FromStr>::Err>

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

impl<U: TimeUnitTrait> GetDataType for DateTime<U>

Available on crate feature time only.
Source§

fn dtype() -> DataType

Returns the DataType corresponding to the implementing type. Read more
Source§

impl<U> Hash for DateTime<U>
where U: Hash + TimeUnitTrait,

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<Unit: TimeUnitTrait> IsNone for DateTime<Unit>

Available on crate feature time only.
Source§

type Inner = DateTime<Unit>

Source§

type Cast<U: IsNone<Inner = U> + Clone> = U

Source§

fn is_none(&self) -> bool

Checks if the value is in the “none” state. Read more
Source§

fn none() -> Self

Creates a new instance of Self in the “none” state. Read more
Source§

fn to_opt(self) -> Option<Self::Inner>

Converts the value to an Option<Self::Inner>. Read more
Source§

fn as_opt(&self) -> Option<&Self::Inner>

Converts the value to an Option<&Self::Inner>. Read more
Source§

fn from_inner(inner: Self::Inner) -> Self

Creates a new instance of Self from the given inner value. Read more
Source§

fn inner_cast<U: IsNone<Inner = U> + Clone>(inner: U) -> Self::Cast<U>
where Self::Inner: Cast<U::Inner>,

Casts the inner type of Self to a new type U. Read more
Source§

fn unwrap(self) -> Self::Inner

Source§

fn map<F, U: IsNone>(self, f: F) -> U
where F: Fn(Self::Inner) -> U::Inner,

Maps a function over the inner value of Self, if it exists. Read more
Source§

fn from_opt(opt: Option<Self::Inner>) -> Self

Creates a new instance of Self from an Option<Self::Inner>.
Source§

fn not_none(&self) -> bool

Source§

fn sort_cmp(&self, other: &Self) -> Ordering
where Self::Inner: PartialOrd,

Compares two values for sorting, treating None as the largest value. Read more
Source§

fn sort_cmp_rev(&self, other: &Self) -> Ordering
where Self::Inner: PartialOrd,

Compares two values for reverse sorting, treating None as the largest value. Read more
Source§

impl<U> Ord for DateTime<U>
where U: Ord + TimeUnitTrait,

Source§

fn cmp(&self, other: &DateTime<U>) -> Ordering

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

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

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

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

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

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

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

impl<U> PartialEq for DateTime<U>

Source§

fn eq(&self, other: &DateTime<U>) -> bool

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

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

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

impl<U> PartialOrd for DateTime<U>

Source§

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

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

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

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

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

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

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

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

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

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

impl<U> Sub<TimeDelta> for DateTime<U>

Source§

type Output = DateTime<U>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: TimeDelta) -> <DateTime<U> as Sub<TimeDelta>>::Output

Performs the - operation. Read more
Source§

impl<U> Sub for DateTime<U>

Source§

type Output = TimeDelta

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: DateTime<U>) -> <DateTime<U> as Sub>::Output

Performs the - operation. Read more
Source§

impl TryFrom<DateTime<Microsecond>> for DateTime<Utc>

Source§

type Error = TError

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

fn try_from(dt: DateTime<Microsecond>) -> Result<DateTime<Utc>, TError>

Performs the conversion.
Source§

impl TryFrom<DateTime<Millisecond>> for DateTime<Utc>

Source§

type Error = TError

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

fn try_from(dt: DateTime<Millisecond>) -> Result<DateTime<Utc>, TError>

Performs the conversion.
Source§

impl TryFrom<DateTime<Second>> for DateTime<Utc>

Source§

type Error = TError

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

fn try_from(dt: DateTime<Second>) -> Result<DateTime<Utc>, TError>

Performs the conversion.
Source§

impl TryFrom<DateTime> for DateTime<Utc>

Source§

type Error = TError

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

fn try_from(dt: DateTime) -> Result<DateTime<Utc>, TError>

Performs the conversion.
Source§

impl<U> Copy for DateTime<U>
where U: Copy + TimeUnitTrait,

Source§

impl<U> Eq for DateTime<U>
where U: Eq + TimeUnitTrait,

Source§

impl<U> Send for DateTime<U>
where U: TimeUnitTrait,

Source§

impl<U> StructuralPartialEq for DateTime<U>
where U: TimeUnitTrait,

Source§

impl<U> Sync for DateTime<U>
where U: TimeUnitTrait,

Auto Trait Implementations§

§

impl<U> Freeze for DateTime<U>

§

impl<U> RefUnwindSafe for DateTime<U>
where U: RefUnwindSafe,

§

impl<U> Unpin for DateTime<U>
where U: Unpin,

§

impl<U> UnwindSafe for DateTime<U>
where U: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> Cast<Option<T>> for T
where T: IsNone,

Source§

fn cast(self) -> Option<T>

Casts the value to the target type T. Read more
Source§

impl<T> Cast<T> for T

Source§

fn cast(self) -> T

Casts the value to the target type T. 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<U> IntoCast for U
where U: IsNone<Inner = U> + Clone,

Source§

fn into_cast<T: IsNone>(self) -> T::Cast<Self>
where T::Inner: Cast<Self::Inner>,

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