~ireas/nitrokey-rs

b181dd0b64b99cadf2ea8c2dbd099e1297b93f8f — Robin Krahl 3 months ago 302fe85
Fix example for PasswordSafe::write_slot

Previously, the documentation for the PasswordSafe::write_slot method
contained an example that only showed the usage of the get_slot_*
methods.  With this patch, we demonstrate the usage of the write_slot
method instead.
1 files changed, 2 insertions(+), 5 deletions(-)

M src/pws.rs
M src/pws.rs => src/pws.rs +2 -5
@@ 300,11 300,8 @@ impl<'a, 'b> PasswordSafe<'a, 'b> {
    /// # fn try_main() -> Result<(), Error> {
    /// let mut manager = nitrokey::take()?;
    /// let mut device = manager.connect()?;
    /// let pws = device.get_password_safe("123456")?;
    /// let name = pws.get_slot_name(0)?;
    /// let login = pws.get_slot_login(0)?;
    /// let password = pws.get_slot_login(0)?;
    /// println!("Credentials for {}: login {}, password {}", name, login, password);
    /// let mut pws = device.get_password_safe("123456")?;
    /// pws.write_slot(0, "rust-lang.org", "admin", "passw0rd")?;
    /// #     Ok(())
    /// # }
    /// ```