pub struct RateLimitSnapshot {
pub graphql: Option<RateLimitResource>,
pub core: Option<RateLimitResource>,
pub search: Option<RateLimitResource>,
}Expand description
A parsed gh api rate_limit snapshot: the resources this monitor surfaces.
Every field is optional and skipped when absent, so the JSON on the daemon’s
status payload carries only what gh actually returned (the daemon’s
forward-compat contract). In practice graphql and core are always present.
Fields§
§graphql: Option<RateLimitResource>The GraphQL API budget — what the PR-badge poller spends.
core: Option<RateLimitResource>The REST (core) API budget.
search: Option<RateLimitResource>The search API budget.
Implementations§
Source§impl RateLimitSnapshot
impl RateLimitSnapshot
Sourcepub fn max_percent(&self) -> f64
pub fn max_percent(&self) -> f64
The highest used-percentage across present resources, or 0.0 when empty.
Sourcepub fn over_warn(&self) -> bool
pub fn over_warn(&self) -> bool
Whether any present resource is at or above WARN_PERCENT.
Sourcepub fn summary_line(&self) -> String
pub fn summary_line(&self) -> String
The one-line summary for daemon status, e.g.
graphql 82% (4100/5000, resets 06:50Z) · core 3% (27/1000), prefixed with
⚠ when any resource is over the warn threshold. Empty when no resource is
present (the caller then prints nothing).
Sourcepub fn tray_label(&self) -> String
pub fn tray_label(&self) -> String
The compact tray label, e.g. github: graphql 82% · core 3%, with a
trailing ⚠ when over the warn threshold. Empty when no resource is present.
Trait Implementations§
Source§impl Clone for RateLimitSnapshot
impl Clone for RateLimitSnapshot
Source§fn clone(&self) -> RateLimitSnapshot
fn clone(&self) -> RateLimitSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RateLimitSnapshot
Source§impl Debug for RateLimitSnapshot
impl Debug for RateLimitSnapshot
Source§impl Default for RateLimitSnapshot
impl Default for RateLimitSnapshot
Source§fn default() -> RateLimitSnapshot
fn default() -> RateLimitSnapshot
Source§impl<'de> Deserialize<'de> for RateLimitSnapshot
impl<'de> Deserialize<'de> for RateLimitSnapshot
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 for RateLimitSnapshot
impl PartialEq for RateLimitSnapshot
Source§impl Serialize for RateLimitSnapshot
impl Serialize for RateLimitSnapshot
impl StructuralPartialEq for RateLimitSnapshot
Auto Trait Implementations§
impl Freeze for RateLimitSnapshot
impl RefUnwindSafe for RateLimitSnapshot
impl Send for RateLimitSnapshot
impl Sync for RateLimitSnapshot
impl Unpin for RateLimitSnapshot
impl UnsafeUnpin for RateLimitSnapshot
impl UnwindSafe for RateLimitSnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more