pub fn add_key<K: AbstractKey>(&mut self, key: &K) -> Result<bool> {
        let wrapped_key = match self.master_key.as_ref() {
            None => {
                return Err(Error::Precondition(format!(
                    "KeyStore must be `new` or opened to add keys"
                )))
            }
            Some(mk) => WrappedKey::wrap(/*to_wrap=*/ mk, /*wrap_with=*/ key)?,
        };

        // If this key is already in the KeyStore, just return.
        if self
            .wrapped_keys
            .iter()
            .filter(|k| k.get_wrapping_digest() == wrapped_key.get_wrapping_digest())
            .next()
            .is_some()
        {
            return Ok(false);
        }

        self.wrapped_keys.push(wrapped_key);
        Ok(true)
    }
/// Add the given wrapping key to this KeyStore. When the KeyStore is opened
/// in the future, this key can be used. Returns true if the key was
/// successfully added, or false if it was already present in the KeyStore.
///
/// If this KeyStore has no master key (it was neither newly generated nor
/// unwrapped), this will return an error instead.
Add the given wrapping key to this KeyStore. When the KeyStore is opened
in the future, this key can be used. Returns true if the key was
successfully added, or false if it was already present in the KeyStore.

If this KeyStore has no master key (it was neither newly generated nor
unwrapped), this will return an error instead.
Add the given wrapping key to this KeyStore . When the KeyStore is opened in the future this key can be used . Returns true if the key was successfully added or false if it was already present in the KeyStore . If this KeyStore has no master key ( it was neither newly generated nor unwrapped ) this will return an error instead .
pub fn add_key<K: AbstractKey>(&mut self, key: &K) -> Result<bool> {
        let wrapped_key = match self.master_key.as_ref() {
            None => {
                return Err(Error::Precondition(format!(
                    "KeyStore must be `new` or opened to add keys"
                )))
            }
            Some(mk) => WrappedKey::wrap(/*to_wrap=*/ mk, /*wrap_with=*/ key)?,
        };
        // If this key is already in the KeyStore, just return.
        if self
            .wrapped_keys
            .iter()
            .filter(|k| k.get_wrapping_digest() == wrapped_key.get_wrapping_digest())
            .next()
            .is_some()
        {
            return Ok(false);
        }
        self.wrapped_keys.push(wrapped_key);
        Ok(true)
    }
pub fn add_key < K : AbstractKey > ( & mut self , key : & K ) -> Result < bool > { let wrapped_key = match self . master_key . as_ref ( ) { None => { return Err ( Error :: Precondition ( format ! ( " " ) ) ) } Some ( mk ) => WrappedKey :: wrap ( /*to_wrap=*/ mk , /*wrap_with=*/ key ) ? , } ; // If this key is already in the KeyStore, just return. if self . wrapped_keys . iter ( ) . filter ( | k | k . get_wrapping_digest ( ) == wrapped_key . get_wrapping_digest ( ) ) . next ( ) . is_some ( ) { return Ok ( false ) ; } self . wrapped_keys . push ( wrapped_key ) ; Ok ( true ) }
Add the given wrapping key to this KeyStore.
Add the given wrapping key to this KeyStore .
&mut self
key
&K
&mut self
key
&K