Skip to main content

LicenseWorker

Struct LicenseWorker 

Source
pub struct LicenseWorker { /* private fields */ }
Expand description

Owns the persisted license state plus an optional background check. Drive it from your UI loop: call poll every frame, read status / unlocked / log, and trigger work with activate.

Implementations§

Source§

impl LicenseWorker

Source

pub fn new(config: LicenseConfig, provider: Arc<dyn LicenseProvider>) -> Self

Load persisted state and, if a key is stored, kick off a validation immediately.

Source

pub fn keygen(config: LicenseConfig) -> Self

Convenience: wire a KeygenProvider from the config.

Source

pub fn status(&self) -> LicenseStatus

Source

pub fn unlocked(&self) -> bool

Source

pub fn log(&self) -> &[String]

Source

pub fn last_message(&self) -> Option<&str>

The most recent log line, if any.

Source

pub fn is_checking(&self) -> bool

Is a validation currently in flight?

Source

pub fn key(&self) -> &str

The current key (e.g. to render the field).

Source

pub fn set_key(&mut self, key: impl Into<String>)

Replace the key (e.g. from a text field or a paste).

Source

pub fn key_mut(&mut self) -> &mut String

Mutable access to the key, for binding directly to a GUI text field.

Source

pub fn clear_key(&mut self)

Clear the key.

Source

pub fn buy_url(&self) -> &str

Where a “Buy” button should open.

Source

pub fn activate(&mut self)

(Re)validate the current key, unless a check is already running.

Source

pub fn poll(&mut self) -> bool

Drain progress and apply a finished check. Call once per UI frame. Returns true if the status changed on this call (handy to request a repaint).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V