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) -> bool

predicate && (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.

ParameterType
predicateimpl FnOnce(&ContributionResult) -> bool (see ContributionResult)

Returns: bool

due_with#

pub async fn due_with(
    &self,
    predicate: impl FnOnce(&ContributionResult) -> bool,
    options: DueOptions,
) -> bool

Nag::due with options (force).

ParameterType
predicateimpl FnOnce(&ContributionResult) -> bool (see ContributionResult)
optionsDueOptions

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 Nag
  • impl Debug for Nag