pub struct Entry { /* private fields */ }
Implementations§
source§impl Entry
impl Entry
sourcepub fn new(service: &str, user: &str) -> Result<Entry>
pub fn new(service: &str, user: &str) -> Result<Entry>
Create an entry for the given service and user.
The default credential builder is used.
sourcepub fn new_with_target(target: &str, service: &str, user: &str) -> Result<Entry>
pub fn new_with_target(target: &str, service: &str, user: &str) -> Result<Entry>
Create an entry for the given target, service, and user.
The default credential builder is used.
sourcepub fn new_with_credential(credential: Box<Credential>) -> Entry
pub fn new_with_credential(credential: Box<Credential>) -> Entry
Create an entry that uses the given platform credential for storage.
sourcepub fn set_password(&self, password: &str) -> Result<()>
pub fn set_password(&self, password: &str) -> Result<()>
Set the password for this entry.
Can return an Ambiguous error if there is more than one platform credential that matches this entry. This can only happen on some platforms, and then only if a third-party application wrote the ambiguous credential.
sourcepub fn get_password(&self) -> Result<String>
pub fn get_password(&self) -> Result<String>
Retrieve the password saved for this entry.
Returns a NoEntry error if there isn’t one.
Can return an Ambiguous error if there is more than one platform credential that matches this entry. This can only happen on some platforms, and then only if a third-party application wrote the ambiguous credential.
sourcepub fn delete_password(&self) -> Result<()>
pub fn delete_password(&self) -> Result<()>
sourcepub fn get_credential(&self) -> &dyn Any
pub fn get_credential(&self) -> &dyn Any
Return a reference to this entry’s wrapped credential.
The reference is of the Any type so it can be downgraded to a concrete credential object. The client must know what type of concrete object to cast to.