Skip to main content

InternetPassword

Struct InternetPassword 

Source
pub struct InternetPassword;
Available on macOS and crate feature full only.

Implementations§

Source§

impl InternetPassword

Source

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}
Source

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}
Source

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§

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<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, 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.