dtt

Struct DateTime

Source
pub struct DateTime {
    pub datetime: PrimitiveDateTime,
    pub offset: UtcOffset,
}
Expand description

Represents a date and time with timezone offset support.

This struct combines a UTC datetime with a timezone offset, allowing for timezone-aware datetime operations. While it supports fixed offsets, it does not automatically handle DST transitions.

§Examples

use dtt::datetime::DateTime;

let utc = DateTime::new();
let maybe_est = utc.convert_to_tz("EST");
if let Ok(est) = maybe_est {
    // ...
}

Fields§

§datetime: PrimitiveDateTime

The date and time in UTC (when offset = UtcOffset::UTC) or a user-chosen offset if offset != UtcOffset::UTC.

§offset: UtcOffset

The timezone offset from UTC.

Implementations§

Source§

impl DateTime

Source

pub fn new() -> Self

Creates a new DateTime instance representing the current UTC time.

§Examples
use dtt::datetime::DateTime;

let now = DateTime::new();
Source

pub fn new_with_tz(tz: &str) -> Result<Self, DateTimeError>

Creates a new DateTime instance with the current time in the specified timezone.

§Arguments
  • tz - A timezone abbreviation (e.g., “UTC”, “EST”, “PST”)
§Returns

Returns a Result containing either the new DateTime instance or a DateTimeError if the timezone is invalid.

§Examples
use dtt::datetime::DateTime;

let maybe_est_time = DateTime::new_with_tz("EST");
if let Ok(est_time) = maybe_est_time {
    // ...
}
§Errors

Returns a DateTimeError if the timezone is invalid.

Source

pub fn new_with_custom_offset( hours: i8, minutes: i8, ) -> Result<Self, DateTimeError>

Creates a new DateTime instance with a custom UTC offset.

§Arguments
  • hours - Hour offset from UTC (-23 to +23)
  • minutes - Minute offset from UTC (-59 to +59)
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the offset is invalid.

§Examples
use dtt::datetime::DateTime;

// Create time with UTC+5:30 offset (e.g., for India)
let maybe_ist = DateTime::new_with_custom_offset(5, 30);
if let Ok(ist) = maybe_ist {
    // ...
}
§Errors

Returns a DateTimeError if the timezone is invalid.

Source

pub fn previous_day(&self) -> Result<Self, DateTimeError>

Returns a new DateTime which is exactly one day earlier.

§Returns

Returns a Result containing the new DateTime or a DateTimeError if subtracting one day would result in an invalid date.

§Examples
use dtt::datetime::DateTime;

let now = DateTime::new();
let maybe_yesterday = now.previous_day();
assert!(maybe_yesterday.is_ok());
§Errors

Returns a DateTimeError if the resulting date would be invalid.

Source

pub fn next_day(&self) -> Result<Self, DateTimeError>

Returns a new DateTime which is exactly one day later.

§Returns

Returns a Result containing the new DateTime or a DateTimeError if adding one day would result in an invalid date.

§Examples
use dtt::datetime::DateTime;

let now = DateTime::new();
let maybe_tomorrow = now.next_day();
assert!(maybe_tomorrow.is_ok());
§Errors

Returns a DateTimeError if the resulting date would be invalid.

Source

pub fn set_time( &self, hour: u8, minute: u8, second: u8, ) -> Result<Self, DateTimeError>

Sets the time components (hour, minute, second) while preserving the current date and timezone offset.

§Arguments
  • hour - Hour (0-23)
  • minute - Minute (0-59)
  • second - Second (0-59)
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the time components are invalid.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
// Attempt to set the time to 10:30:45
let updated_dt = dt.set_time(10, 30, 45);
assert!(updated_dt.is_ok());
if let Ok(new_val) = updated_dt {
    assert_eq!(new_val.hour(), 10);
    assert_eq!(new_val.minute(), 30);
    assert_eq!(new_val.second(), 45);
}
§Errors

Returns a DateTimeError if the resulting time would be invalid.

Source

pub fn sub_years(&self, years: i32) -> Result<Self, DateTimeError>

Subtracts a specified number of years from the DateTime.

Handles leap year transitions appropriately (e.g., if subtracting a year from Feb 29 results in Feb 28).

§Arguments
  • years - Number of years to subtract
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the resulting date would be invalid.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let maybe_past = dt.sub_years(1);
assert!(maybe_past.is_ok());
§Errors

Returns a DateTimeError if the resulting date would be invalid.

Source

pub fn format_time_in_timezone( &self, tz: &str, format_str: &str, ) -> Result<String, DateTimeError>

Converts this DateTime to another timezone, then formats it using the provided format_str.

§Arguments
  • tz - Target timezone abbreviation (e.g., “UTC”, “EST”, “PST”).
  • format_str - A format description (see the time crate documentation for the supported syntax).
§Returns

Returns a Result<String, DateTimeError> containing either the formatted datetime string or an error if conversion or formatting fails.

§Errors

This function will return a DateTimeError if:

  • The specified timezone is not recognized or invalid.
  • The formatting operation fails due to an invalid format_str.
§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let result = dt.format_time_in_timezone("EST", "[hour]:[minute]:[second]");
if let Ok(formatted_str) = result {
    println!("Time in EST: {}", formatted_str);
}
Source

pub fn is_valid_iso_8601(input: &str) -> bool

Returns true if the input string is a valid ISO 8601 or RFC 3339–like datetime/date.

§Arguments
  • input - A string that might represent a date or datetime in ISO 8601/RFC 3339 format.
§Returns

true if the string can be successfully parsed as either:

  • RFC 3339 datetime (e.g., “2024-01-01T12:00:00Z”), or
  • ISO 8601 date (e.g., “2024-01-01”) false otherwise.
§Examples
use dtt::datetime::DateTime;

assert!(DateTime::is_valid_iso_8601("2024-01-01T12:00:00Z"));
assert!(DateTime::is_valid_iso_8601("2024-01-01"));
assert!(!DateTime::is_valid_iso_8601("2024-13-01")); // invalid month
assert!(!DateTime::is_valid_iso_8601("not a date"));
Source

pub fn from_components( year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, offset: UtcOffset, ) -> Result<Self, DateTimeError>

Creates a DateTime instance from individual components.

§Arguments
  • year - Calendar year
  • month - Month (1-12)
  • day - Day of month (1-31, depending on month)
  • hour - Hour (0-23)
  • minute - Minute (0-59)
  • second - Second (0-59)
  • offset - Timezone offset from UTC
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if any component is invalid.

§Examples
use dtt::datetime::DateTime;
use time::UtcOffset;

let dt = DateTime::from_components(2024, 1, 1, 12, 0, 0, UtcOffset::UTC);
assert!(dt.is_ok());
§Errors

Returns a DateTimeError if any component is invalid.

Source

pub const fn year(&self) -> i32

Returns the year component of the DateTime.

Source

pub const fn month(&self) -> Month

Returns the month component of the DateTime.

Source

pub const fn day(&self) -> u8

Returns the day component of the DateTime.

Source

pub const fn hour(&self) -> u8

Returns the hour component of the DateTime.

Source

pub const fn minute(&self) -> u8

Returns the minute component of the DateTime.

Source

pub const fn second(&self) -> u8

Returns the second component of the DateTime.

Source

pub const fn microsecond(&self) -> u32

Returns the microsecond component of the DateTime.

Source

pub const fn iso_week(&self) -> u8

Returns the ISO week component of the DateTime.

Source

pub const fn ordinal(&self) -> u16

Returns the ordinal day (day of year) component of the DateTime.

Source

pub const fn offset(&self) -> UtcOffset

Returns the timezone offset of the DateTime.

Source

pub const fn weekday(&self) -> Weekday

Returns the weekday of the DateTime.

Source

pub fn parse(input: &str) -> Result<Self, DateTimeError>

Parses a string representation of a date and time.

Supports both RFC 3339 and ISO 8601 formats.

§Arguments
  • input - A string slice containing the date/time to parse
§Returns

Returns a Result containing either the parsed DateTime or a DateTimeError if parsing fails.

§Examples
use dtt::datetime::DateTime;

// Parse RFC 3339 format
let dt1 = DateTime::parse("2024-01-01T12:00:00Z");

// Parse ISO 8601 date
let dt2 = DateTime::parse("2024-01-01");
assert!(dt1.is_ok());
assert!(dt2.is_ok());
§Errors

Returns a DateTimeError if the input string is not a valid date/time.

Source

pub fn parse_custom_format( input: &str, format: &str, ) -> Result<Self, DateTimeError>

Parses a date/time string using a custom format specification.

§Arguments
  • input - The date/time string to parse
  • format - Format specification string (see time crate documentation)
§Returns

Returns a Result containing either the parsed DateTime or a DateTimeError if parsing fails.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::parse_custom_format(
    "2024-01-01 12:00:00",
    "[year]-[month]-[day] [hour]:[minute]:[second]"
);
assert!(dt.is_ok());
§Errors

Returns a DateTimeError if the input string is not a valid date/time.

Source

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

Formats the DateTime according to the specified format string.

§Arguments
  • format_str - Format specification string (see time crate documentation)
§Returns

Returns a Result containing either the formatted string or a DateTimeError if formatting fails.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let formatted = dt.format("[year]-[month]-[day]");
assert!(formatted.is_ok());
§Errors

Returns a DateTimeError if the format string is invalid.

Source

pub fn format_rfc3339(&self) -> Result<String, DateTimeError>

Formats the DateTime as an RFC 3339 string.

§Returns

Returns a Result containing either the formatted RFC 3339 string or a DateTimeError if formatting fails.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let maybe_rfc3339 = dt.format_rfc3339();
assert!(maybe_rfc3339.is_ok());
§Errors

Returns a DateTimeError if formatting fails.

Source

pub fn format_iso8601(&self) -> Result<String, DateTimeError>

Formats the DateTime as an ISO 8601 string (YYYY-MM-DDTHH:MM:SS).

§Returns

Returns a Result containing either the formatted ISO 8601 string or a DateTimeError if formatting fails.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let maybe_iso8601 = dt.format_iso8601();
assert!(maybe_iso8601.is_ok());
§Errors

Returns a DateTimeError if formatting fails.

Source

pub fn update(&self) -> Result<Self, DateTimeError>

Updates the DateTime to the current time while preserving the timezone offset.

§Returns

Returns a Result containing either the updated DateTime or a DateTimeError if the update fails.

§Examples
use dtt::datetime::DateTime;
use std::thread::sleep;
use std::time::Duration;

let dt = DateTime::new();
sleep(Duration::from_secs(1));
let updated_dt = dt.update();
assert!(updated_dt.is_ok());
§Errors

Returns a DateTimeError if the update fails.

Source

pub fn convert_to_tz(&self, new_tz: &str) -> Result<Self, DateTimeError>

Converts the current DateTime to another timezone.

§Arguments
  • new_tz - Target timezone abbreviation (e.g., “UTC”, “EST”, “PST”)
§Returns

Returns a Result containing either the DateTime in the new timezone or a DateTimeError if the conversion fails.

§Examples
use dtt::datetime::DateTime;

let utc = DateTime::new();
let maybe_est = utc.convert_to_tz("EST");
assert!(maybe_est.is_ok());
§Errors

Returns a DateTimeError if the timezone is invalid.

Source

pub const fn unix_timestamp(&self) -> i64

Gets the Unix timestamp (seconds since Unix epoch).

§Returns

Returns the number of seconds from the Unix epoch (1970-01-01T00:00:00Z).

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let ts = dt.unix_timestamp();
Source

pub fn duration_since(&self, other: &Self) -> Duration

Calculates the duration between this DateTime and another.

The result can be negative if other is later than self.

§Arguments
  • other - The DateTime to compare with
§Returns

Returns a Duration representing the time difference.

§Examples
use dtt::datetime::DateTime;

let dt1 = DateTime::new();
let dt2 = dt1.add_days(1).unwrap_or(dt1);
let duration = dt1.duration_since(&dt2);
// duration could be negative if dt2 > dt1
Source

pub fn add_days(&self, days: i64) -> Result<Self, DateTimeError>

Adds a specified number of days to the DateTime.

§Arguments
  • days - Number of days to add (can be negative for subtraction)
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the operation would result in an invalid date.

§Errors

This function returns a DateTimeError::InvalidDate if adding days results in a date overflow or otherwise invalid date.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let future = dt.add_days(7);
assert!(future.is_ok());
Source

pub fn add_months(&self, months: i32) -> Result<Self, DateTimeError>

Adds a specified number of months to the DateTime.

Handles month-end dates and leap years appropriately.

§Arguments
  • months - Number of months to add (can be negative for subtraction)
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the operation would result in an invalid date.

§Errors

This function returns a DateTimeError if:

  • The calculated year, month, or day is invalid (e.g., out of range).
  • The underlying date library fails to construct a valid date.
§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let future = dt.add_months(3);
assert!(future.is_ok());
Source

pub fn sub_months(&self, months: i32) -> Result<Self, DateTimeError>

Subtracts a specified number of months from the DateTime.

§Arguments
  • months - Number of months to subtract
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the operation would result in an invalid date.

§Errors

This function returns a DateTimeError::InvalidDate if:

  • The resulting date is out of valid range.
  • The underlying date library fails to construct a valid DateTime.
§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let past = dt.sub_months(3);
assert!(past.is_ok());
Source

pub fn add_years(&self, years: i32) -> Result<Self, DateTimeError>

Adds a specified number of years to the DateTime.

Handles leap-year transitions appropriately.

§Arguments
  • years - Number of years to add (can be negative for subtraction)
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the operation would result in an invalid date.

§Errors

This function returns a DateTimeError::InvalidDate if:

  • The resulting year is out of valid range.
  • A non-leap year cannot accommodate February 29th.
  • Any other invalid date scenario occurs during calculation.
§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let future = dt.add_years(5);
assert!(future.is_ok());
Source

pub fn start_of_week(&self) -> Result<Self, DateTimeError>

Returns a new DateTime for the start of the current week (Monday).

§Errors

This function can return a DateTimeError if an overflow or invalid date calculation occurs during date arithmetic.

Source

pub fn end_of_week(&self) -> Result<Self, DateTimeError>

Returns a new DateTime for the end of the current week (Sunday).

§Errors

This function can return a DateTimeError if an overflow or invalid date calculation occurs during date arithmetic.

Source

pub fn start_of_month(&self) -> Result<Self, DateTimeError>

Returns a new DateTime for the start of the current month.

§Errors

This function can return a DateTimeError if the date cannot be constructed (e.g., due to an invalid year or month).

Source

pub fn end_of_month(&self) -> Result<Self, DateTimeError>

Returns a new DateTime for the end of the current month.

§Errors

This function can return a DateTimeError if the date cannot be constructed (e.g., days_in_month fails to provide a valid day).

Source

pub fn start_of_year(&self) -> Result<Self, DateTimeError>

Returns a new DateTime for the start of the current year.

§Errors

This function can return a DateTimeError if the date cannot be constructed (e.g., invalid year).

Source

pub fn end_of_year(&self) -> Result<Self, DateTimeError>

Returns a new DateTime for the end of the current year.

§Errors

This function can return a DateTimeError if the date cannot be constructed (e.g., invalid year).

Source

pub fn is_within_range(&self, start: &Self, end: &Self) -> bool

Checks if the current DateTime falls within a specific date range (inclusive).

§Arguments
  • start - Start of the date range (inclusive)
  • end - End of the date range (inclusive)
§Returns

Returns true if the current DateTime falls within the range, false otherwise.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let start = dt.add_days(-1).unwrap_or(dt);
let end = dt.add_days(1).unwrap_or(dt);

assert!(dt.is_within_range(&start, &end));
Source

pub fn set_date( &self, year: i32, month: u8, day: u8, ) -> Result<Self, DateTimeError>

Sets the date components while maintaining the current time.

§Arguments
  • year - Calendar year
  • month - Month (1-12)
  • day - Day of month (1-31)
§Returns

Returns a Result containing either the new DateTime or a DateTimeError if the date is invalid.

§Examples
use dtt::datetime::DateTime;

let dt = DateTime::new();
let new_dt = dt.set_date(2024, 1, 1);
assert!(new_dt.is_ok());
§Errors

Returns a DateTimeError if the resulting date would be invalid.

Source§

impl DateTime

Source

pub fn is_valid_day(day: &str) -> bool

Validates whether a string represents a valid day of the month.

Source

pub fn is_valid_hour(hour: &str) -> bool

Validates whether a string represents a valid hour.

Source

pub fn is_valid_minute(minute: &str) -> bool

Validates whether a string represents a valid minute.

Source

pub fn is_valid_second(second: &str) -> bool

Validates whether a string represents a valid second.

Source

pub fn is_valid_month(month: &str) -> bool

Validates whether a string represents a valid month.

Source

pub fn is_valid_year(year: &str) -> bool

Validates whether a string represents a valid year.

Source

pub fn is_valid_microsecond(microsecond: &str) -> bool

Validates whether a string represents a valid microsecond.

Source

pub fn is_valid_ordinal(ordinal: &str) -> bool

Validates whether a string represents a valid ordinal day of the year.

Source

pub fn is_valid_iso_week(week: &str) -> bool

Validates whether a string represents a valid ISO week number.

Source

pub fn is_valid_time(time: &str) -> bool

Validates whether a string represents a valid time in HH:MM:SS format.

Trait Implementations§

Source§

impl Add<Duration> for DateTime

Source§

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

Adds a Duration to the DateTime.

§Arguments
  • rhs - Duration to add
§Returns

Returns a Result containing either the new DateTime or a DateTimeError.

Source§

type Output = Result<DateTime, DateTimeError>

The resulting type after applying the + operator.
Source§

impl Clone for DateTime

Source§

fn clone(&self) -> DateTime

Returns a copy 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 Debug for DateTime

Source§

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

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

impl Default for DateTime

Source§

fn default() -> Self

Returns the current UTC time as the default DateTime value.

Source§

impl<'de> Deserialize<'de> for DateTime

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl Display for DateTime

Source§

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

Formats the DateTime using RFC 3339 format.

Source§

impl FromStr for DateTime

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string into a DateTime instance (RFC 3339 or ISO 8601).

Source§

type Err = DateTimeError

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

impl Hash for DateTime

Source§

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

Computes a hash value for the DateTime based on its components.

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 DateTime

Source§

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

Compares two DateTimes for ordering.

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 PartialEq for DateTime

Source§

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

Source§

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

Compares two DateTime for ordering, returning Some(Ordering).

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 Serialize for DateTime

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<Duration> for DateTime

Source§

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

Subtracts a Duration from the DateTime.

§Arguments
  • rhs - Duration to subtract
§Returns

Returns a Result containing either the new DateTime or a DateTimeError.

Source§

type Output = Result<DateTime, DateTimeError>

The resulting type after applying the - operator.
Source§

impl Copy for DateTime

Source§

impl Eq for DateTime

Source§

impl StructuralPartialEq for DateTime

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,