pub trait Credentials: Send + Sync {
// Required methods
fn token(&self) -> Option<String>;
fn save_token(&self, token: &str) -> Result<PathBuf>;
fn forget_token(&self);
fn client_id(&self) -> String;
fn pending_request(&self, identity: &str) -> Option<PendingRequest>;
fn save_pending_request(&self, identity: &str, request: &PendingRequest);
fn clear_pending_request(&self);
}Expand description
What an application keeps on this desktop so Onboard does not have
to: a device token, the identity it asks under, and a request it is
still waiting to hear back about. Implemented once per application –
see the module’s own doc for why storage itself stays out of this
crate.
Send + Sync + 'static: Onboard::seek moves the implementor onto a
background thread, alongside the network call it accompanies.
Required Methods§
Sourcefn save_token(&self, token: &str) -> Result<PathBuf>
fn save_token(&self, token: &str) -> Result<PathBuf>
Saves a freshly issued token. Errors are the caller’s to log: a token that fails to save still works for the rest of this run, it just will not survive a restart.
Sourcefn forget_token(&self)
fn forget_token(&self)
Throws the saved token away, so the next start asks again.
Sourcefn client_id(&self) -> String
fn client_id(&self) -> String
What this installation calls itself to the server – made once and kept, so the same device keeps its place in the administrator’s list across restarts.
Sourcefn pending_request(&self, identity: &str) -> Option<PendingRequest>
fn pending_request(&self, identity: &str) -> Option<PendingRequest>
The request identity is still waiting on, if one was saved.
Sourcefn save_pending_request(&self, identity: &str, request: &PendingRequest)
fn save_pending_request(&self, identity: &str, request: &PendingRequest)
Remembers a request just sent.
Sourcefn clear_pending_request(&self)
fn clear_pending_request(&self)
Drops the record of a request once it has been decided.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".