pub enum ResetTime {
Seconds(usize),
DateTime(OffsetDateTime),
}Expand description
Reset time of rate limiting
There are different variants on how to specify reset times in rate limit headers. The most common ones are seconds and datetime.
Variants§
Seconds(usize)
Number of seconds until rate limit is lifted
DateTime(OffsetDateTime)
Date when rate limit will be lifted
Implementations§
Trait Implementations§
Source§impl TryFrom<&str> for ResetTime
impl TryFrom<&str> for ResetTime
Source§fn try_from(value: &str) -> Result<Self, Error>
fn try_from(value: &str) -> Result<Self, Error>
Best-effort parsing of a reset-time header value when the vendor
(and therefore the ResetTimeKind) is not known.
Tries, in order:
- Numeric Unix timestamp, if the value is large enough to plausibly be one (above ~Sep 2001).
- Numeric seconds-from-now offset, for smaller numeric values.
- RFC 2822 / IMF-fixdate.
- RFC 3339 / ISO 8601.
Returns Error::NoMatchingVariant if none of these succeed.
impl Copy for ResetTime
impl Eq for ResetTime
impl StructuralPartialEq for ResetTime
Auto Trait Implementations§
impl Freeze for ResetTime
impl RefUnwindSafe for ResetTime
impl Send for ResetTime
impl Sync for ResetTime
impl Unpin for ResetTime
impl UnsafeUnpin for ResetTime
impl UnwindSafe for ResetTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more