Struct scratchstack_http_framework::RequestId
source · pub struct RequestId { /* private fields */ }
Expand description
AWS request id implementation.
This implementation abuses the UUID format the embed a timestamp in the UUID to make it easier to track down the request in the logs. This timestamp has a resolution of 1s and is based on the system clock, so it’s not guaranteed to be unique; thus, a random number is also embedded in the UUID.
Implementations§
source§impl RequestId
impl RequestId
sourcepub fn from_timestamp_and_random(unix_timestamp: i64, random: u64) -> Self
pub fn from_timestamp_and_random(unix_timestamp: i64, random: u64) -> Self
Create a new request id from the given timestamp, in seconds from the Unix epoch (January 1, 1970 at 00:00:00 UTC) and random number.
sourcepub fn from_datetime_and_random<Tz: TimeZone>(
datetime: DateTime<Tz>,
random: u64
) -> Self
pub fn from_datetime_and_random<Tz: TimeZone>(
datetime: DateTime<Tz>,
random: u64
) -> Self
Create a new request id from the given timestamp and random number.
sourcepub fn from_timestamp(unix_timestamp: i64) -> Self
pub fn from_timestamp(unix_timestamp: i64) -> Self
Create a new request id from the given timestamp, in seconds from the Unix epoch (January 1, 1970 at 00:00:00 UTC).
sourcepub fn from_datetime<Tz: TimeZone>(datetime: DateTime<Tz>) -> Self
pub fn from_datetime<Tz: TimeZone>(datetime: DateTime<Tz>) -> Self
Create a new request id from the given timestamp.
sourcepub fn unix_timestamp(&self) -> u64
pub fn unix_timestamp(&self) -> u64
Returns the Unix timestamp, in seconds from the Unix epoch (January 1, 1970 at 00:00:00 UTC), embedded in this request id.
Trait Implementations§
source§impl<'de> Deserialize<'de> for RequestId
impl<'de> Deserialize<'de> for RequestId
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl PartialEq<RequestId> for RequestId
impl PartialEq<RequestId> for RequestId
impl Copy for RequestId
impl Eq for RequestId
impl StructuralEq for RequestId
impl StructuralPartialEq for RequestId
Auto Trait Implementations§
impl RefUnwindSafe for RequestId
impl Send for RequestId
impl Sync for RequestId
impl Unpin for RequestId
impl UnwindSafe for RequestId
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.