// Delete a key if it matches a value
Delete a key if it matches a value
Delete a key if it matches a value
pub fn delc(&mut self, key: K, chk: Option<V>) -> Result<(), Error> {
		// Check to see if transaction is closed
		if self.ok == true {
			return Err(Error::TxClosed);
		}
		// Check to see if transaction is writable
		if self.rw == false {
			return Err(Error::TxNotWritable);
		}
		// Remove the key
		match (self.ds.get(&key), &chk) {
			(Some(v), Some(w)) if v == w => self.ds.remove(&key),
			(None, None) => self.ds.remove(&key),
			_ => return Err(Error::ValNotExpectedValue),
		};
		// Return result
		Ok(())
	}
pub fn delc ( & mut self , key : K , chk : Option < V > ) -> Result < ( ) , Error > { // Check to see if transaction is closed if self . ok == true { return Err ( Error :: TxClosed ) ; } // Check to see if transaction is writable if self . rw == false { return Err ( Error :: TxNotWritable ) ; } // Remove the key match ( self . ds . get ( & key ) , & chk ) { ( Some ( v ) , Some ( w ) ) if v == w => self . ds . remove ( & key ) , ( None , None ) => self . ds . remove ( & key ) , _ => return Err ( Error :: ValNotExpectedValue ) , } ; // Return result Ok ( ( ) ) }
Delete a key if it matches a value
Delete a key if it matches a value
&mut self
key
K
chk
Option<V>