Nag
A nag created by Sponsorkit::nag.
On this page
A nag created by Sponsorkit::nag.
use sponsorkit::Nag;
pub struct Nag { /* private fields */ }Methods#
due#
pub async fn due(&self, predicate: impl FnOnce(&ContributionResult) -> bool) -> boolpredicate && (runs >= every || since(last_shown) >= or_every).
The run counter goes up once per process on the first call (even when
the result is false). Always false when SPONSORKIT_DISABLE,
SPONSORKIT_NO_NAG or CI is set or stdout/stderr is not a terminal.
Never signs in. Errors (e.g. the dev-time target check) read as false.
| Parameter | Type |
|---|---|
predicate | impl FnOnce(&ContributionResult) -> bool (see ContributionResult) |
Returns: bool
due_with#
pub async fn due_with(
&self,
predicate: impl FnOnce(&ContributionResult) -> bool,
options: DueOptions,
) -> boolNag::due with options (force).
| Parameter | Type |
|---|---|
predicate | impl FnOnce(&ContributionResult) -> bool (see ContributionResult) |
options | DueOptions |
Returns: bool
shown#
pub async fn shown(&self)Records that the nag was shown: resets the run counter and last_shown.
Trait implementations#
impl Clone for Nagimpl Debug for Nag