pub trait IntoTimestamp {
// Required method
fn into_timestamp_string(self) -> String;
}Expand description
Converts a user-supplied timestamp value into the wire form accepted by the API (a nanosecond count encoded as a JSON string).
Implemented for:
i64— treated as nanoseconds since the Unix epoch.&strandString— passed through verbatim (caller’s responsibility to supply a format the API accepts: ISO 8601 or a nanosecond string).Nanos.chrono::DateTime<Utc>when thechronofeature is enabled.time::OffsetDateTimewhen thetimefeature is enabled.
§Panics
The chrono::DateTime<Utc> impl panics if the datetime falls outside
the i64 nanosecond range (roughly 1677-09-21 to 2262-04-11). Any
realistic trading-data timestamp is comfortably within range.
§Examples
use ticksupply::IntoTimestamp;
assert_eq!(1_704_067_200_000_000_000_i64.into_timestamp_string(), "1704067200000000000");
assert_eq!("2024-01-01T00:00:00Z".into_timestamp_string(), "2024-01-01T00:00:00Z");Required Methods§
Sourcefn into_timestamp_string(self) -> String
fn into_timestamp_string(self) -> String
Encodes the timestamp as a string suitable for the API.
§Examples
use ticksupply::IntoTimestamp;
assert_eq!(123_i64.into_timestamp_string(), "123");Implementations on Foreign Types§
Source§impl IntoTimestamp for &str
impl IntoTimestamp for &str
fn into_timestamp_string(self) -> String
Source§impl IntoTimestamp for i64
impl IntoTimestamp for i64
fn into_timestamp_string(self) -> String
Source§impl IntoTimestamp for String
impl IntoTimestamp for String
fn into_timestamp_string(self) -> String
Source§impl IntoTimestamp for DateTime<Utc>
Available on crate feature chrono only.
impl IntoTimestamp for DateTime<Utc>
Available on crate feature
chrono only.fn into_timestamp_string(self) -> String
Source§impl IntoTimestamp for OffsetDateTime
Available on crate feature time only.
impl IntoTimestamp for OffsetDateTime
Available on crate feature
time only.