#[repr(transparent)]
pub struct TimestampRef(_);
Expand description

A reference to a borrowed Timestamp

Implementations

Transparently reinterprets the string slice as a strongly-typed TimestampRef if it conforms to Timestamp

Transparently reinterprets the string slice as a strongly-typed TimestampRef without validating

Converts a Box<TimestampRef> into a Timestamp without copying or allocating

Provides access to the underlying value as a string slice.

Normalize the timestamp into UTC time.

Examples
use twitch_api2::types::Timestamp;

let time = Timestamp::new("2021-07-01T13:37:00Z").unwrap();
assert_eq!(time.normalize()?.as_ref(), &time);
let time2 = Timestamp::new("2021-07-01T13:37:00-01:00").unwrap();
assert_ne!(time2.normalize()?.as_ref(), &time2);

Compare another time and return self < other.

Examples
use twitch_api2::types::Timestamp;

let time2021 = Timestamp::new("2021-07-01T13:37:00Z").unwrap();
let time2020 = Timestamp::new("2020-07-01T13:37:00Z").unwrap();
assert!(time2020.is_before(&time2021));

Make a timestamp with the time component set to 00:00:00.

Examples
use twitch_api2::types::Timestamp;

let time = Timestamp::new("2021-07-01T13:37:00Z").unwrap();
assert_eq!(time.to_day().as_str(), "2021-07-01T00:00:00Z")
Available on crate feature time only.

Construct into a OffsetDateTime time with a guaranteed UTC offset.

Panics

This method assumes the timestamp is a valid rfc3339 timestamp, and panics if not.

Available on crate feature time only.

Construct into a OffsetDateTime time.

Panics

This method assumes the timestamp is a valid rfc3339 timestamp, and panics if not.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Immutably borrows from an owned value. Read more

Immutably borrows from an owned value. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Converts the given value to a String. Read more