pub fn with_node_mut<T, F, R>(node: &NodePtr, f: F) -> Option<R>Expand description
Get a mutable reference to a node if it is of the specified type and call the closure with the mutable reference. Usage:
use keepass_ng::db::{with_node_mut, Entry, Group, NodePtr, rc_refcell_node};
let node: NodePtr = rc_refcell_node(Group::new("group"));
with_node_mut::<Group, _, _>(&node, |group| {
// do something with group
});
with_node_mut::<Entry, _, _>(&node, |entry| {
// do something with entry
});