pub struct NodeId { /* private fields */ }Expand description
Identifies a node for exactly as long as that node exists.
The generation in the key is the point: an application that keeps an id
after removing the node gets None back, not somebody else’s widget. That
is also why the tree stores ids rather than references — parent-linked
component graphs are what forced Rc<RefCell<_>> on CoreCanvas, and this
is the replacement.
Implementations§
Source§impl NodeId
impl NodeId
Sourcepub fn as_ffi(self) -> u64
pub fn as_ffi(self) -> u64
The key as a plain u64, for carrying across the C ABI: the generation
in the high half and the slot, counted from one, in the low half. Never
0, which is what the C side uses for “no node”.
Sourcepub fn from_ffi(value: u64) -> Self
pub fn from_ffi(value: u64) -> Self
Rebuilds a key from NodeId::as_ffi. A value that never came from there
simply fails to resolve.
Trait Implementations§
impl Copy for NodeId
impl Eq for NodeId
Source§impl Ord for NodeId
impl Ord for NodeId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for NodeId
impl PartialOrd for NodeId
impl StructuralPartialEq for NodeId
Auto Trait Implementations§
impl Freeze for NodeId
impl RefUnwindSafe for NodeId
impl Send for NodeId
impl Sync for NodeId
impl Unpin for NodeId
impl UnsafeUnpin for NodeId
impl UnwindSafe for NodeId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more