pub struct RateLimitResource {
pub used: u64,
pub limit: u64,
pub remaining: u64,
pub percent: f64,
pub reset: i64,
}Expand description
One resource’s budget usage, parsed from a /rate_limit resources.<name>
object.
Fields§
§used: u64Requests spent in the current window.
limit: u64The window’s ceiling.
remaining: u64Requests remaining (limit - used, as GitHub reports it).
percent: f64used / limit * 100, rounded to one decimal. 0.0 when limit is 0, so
a missing or zero ceiling never divides by zero or reads as “over budget”.
reset: i64Unix epoch (seconds) at which the window resets. Rendered as HH:MMZ by
format_reset_utc; kept raw on the wire so machines can compute their own.
Implementations§
Source§impl RateLimitResource
impl RateLimitResource
Sourcepub fn over_warn(&self) -> bool
pub fn over_warn(&self) -> bool
Whether this resource is at or above the WARN_PERCENT threshold.
Trait Implementations§
Source§impl Clone for RateLimitResource
impl Clone for RateLimitResource
Source§fn clone(&self) -> RateLimitResource
fn clone(&self) -> RateLimitResource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RateLimitResource
Source§impl Debug for RateLimitResource
impl Debug for RateLimitResource
Source§impl<'de> Deserialize<'de> for RateLimitResource
impl<'de> Deserialize<'de> for RateLimitResource
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RateLimitResource
impl PartialEq for RateLimitResource
Source§impl Serialize for RateLimitResource
impl Serialize for RateLimitResource
impl StructuralPartialEq for RateLimitResource
Auto Trait Implementations§
impl Freeze for RateLimitResource
impl RefUnwindSafe for RateLimitResource
impl Send for RateLimitResource
impl Sync for RateLimitResource
impl Unpin for RateLimitResource
impl UnsafeUnpin for RateLimitResource
impl UnwindSafe for RateLimitResource
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