pub struct TreeWeak<T> { /* private fields */ }
Expand description
A weak reference to the tree, without ownership.
Implementations
sourceimpl<T> TreeWeak<T>
impl<T> TreeWeak<T>
sourcepub fn upgrade(&self) -> Option<Tree<T>>
pub fn upgrade(&self) -> Option<Tree<T>>
Attempts to upgrade the weak reference of a tree to a Tree
.
Returns None
if the target tree is already dropped.
use dendron::tree;
let tree = tree!("root");
let tree_weak = tree.downgrade();
assert!(tree_weak.upgrade().is_some());
drop(tree);
assert!(tree_weak.upgrade().is_none());
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for TreeWeak<T>
impl<T> !Send for TreeWeak<T>
impl<T> !Sync for TreeWeak<T>
impl<T> Unpin for TreeWeak<T>
impl<T> !UnwindSafe for TreeWeak<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