pub struct InternetPassword;Available on macOS and crate feature
full only.Implementations§
Source§impl InternetPassword
impl InternetPassword
Sourcepub fn set(server: &str, account: &str, secret: impl AsRef<[u8]>) -> Result<()>
pub fn set(server: &str, account: &str, secret: impl AsRef<[u8]>) -> Result<()>
Examples found in repository?
examples/17_internet_password.rs (line 17)
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 let server = support::unique_service("internet-password");
16 let _cleanup = RemoveOnDrop(&server);
17 InternetPassword::set(&server, "example-account", b"secret-password")?;
18 let credential = InternetPassword::get(&server)?.expect("stored internet password");
19 println!(
20 "account={} round_trip_ok={}",
21 credential.account,
22 credential.secret.as_bytes() == b"secret-password"
23 );
24 InternetPassword::delete(&server)?;
25 Ok(())
26}Sourcepub fn get(server: &str) -> Result<Option<InternetCredential>>
pub fn get(server: &str) -> Result<Option<InternetCredential>>
Examples found in repository?
examples/17_internet_password.rs (line 18)
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 let server = support::unique_service("internet-password");
16 let _cleanup = RemoveOnDrop(&server);
17 InternetPassword::set(&server, "example-account", b"secret-password")?;
18 let credential = InternetPassword::get(&server)?.expect("stored internet password");
19 println!(
20 "account={} round_trip_ok={}",
21 credential.account,
22 credential.secret.as_bytes() == b"secret-password"
23 );
24 InternetPassword::delete(&server)?;
25 Ok(())
26}Sourcepub fn delete(server: &str) -> Result<()>
pub fn delete(server: &str) -> Result<()>
Examples found in repository?
examples/17_internet_password.rs (line 10)
9 fn drop(&mut self) {
10 let _ = InternetPassword::delete(self.0);
11 }
12}
13
14fn main() -> Result<(), Box<dyn std::error::Error>> {
15 let server = support::unique_service("internet-password");
16 let _cleanup = RemoveOnDrop(&server);
17 InternetPassword::set(&server, "example-account", b"secret-password")?;
18 let credential = InternetPassword::get(&server)?.expect("stored internet password");
19 println!(
20 "account={} round_trip_ok={}",
21 credential.account,
22 credential.secret.as_bytes() == b"secret-password"
23 );
24 InternetPassword::delete(&server)?;
25 Ok(())
26}Auto Trait Implementations§
impl Freeze for InternetPassword
impl RefUnwindSafe for InternetPassword
impl Send for InternetPassword
impl Sync for InternetPassword
impl Unpin for InternetPassword
impl UnsafeUnpin for InternetPassword
impl UnwindSafe for InternetPassword
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more