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