Struct dendron::tree::HierarchyEditGrant
source · [−]pub struct HierarchyEditGrant<T>(_);
Expand description
A token to keep the tree hierarchy granted to be edited.
A grant can be created by Tree::grant_hierarchy_edit
or
HotNode::extract_hierarchy_edit_grant
.
A grant can be created by Tree::grant_hierarchy_edit
or
HotNode::extract_hierarchy_edit_grant
.
Implementations
sourceimpl<T> HierarchyEditGrant<T>
impl<T> HierarchyEditGrant<T>
sourcepub fn try_clone(&self) -> Result<Self, HierarchyEditGrantError>
pub fn try_clone(&self) -> Result<Self, HierarchyEditGrantError>
Clones the tree hierarchy edit grant.
Failures
Fails if the number of active edit grants for the tree exceeds
isize::MAX
.
sourcepub fn is_valid_for_node(&self, node: &Node<T>) -> bool
pub fn is_valid_for_node(&self, node: &Node<T>) -> bool
Returns true if the grant is valid for the tree the given node belongs to.
Examples
use dendron::Node;
let node1 = Node::new_tree("foo");
let node2 = Node::new_tree("bar");
let grant1 = node1.tree()
.grant_hierarchy_edit()
.expect("hierarchy edit should not yet be prohibited");
assert!(grant1.is_valid_for_node(&node1));
assert!(!grant1.is_valid_for_node(&node2));
Trait Implementations
sourceimpl<T> Clone for HierarchyEditGrant<T>
impl<T> Clone for HierarchyEditGrant<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for HierarchyEditGrant<T>
impl<T> !Send for HierarchyEditGrant<T>
impl<T> !Sync for HierarchyEditGrant<T>
impl<T> Unpin for HierarchyEditGrant<T>
impl<T> !UnwindSafe for HierarchyEditGrant<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more