Trait intrusive_splay_tree::IntrusiveNode
[−]
[src]
pub unsafe trait IntrusiveNode<'a> where
Self: Sized, { type Elem: TreeOrd<'a, Self>; fn elem_to_node(_: &'a Self::Elem) -> &'a Node<'a>; unsafe fn node_to_elem(_: &'a Node<'a>) -> &'a Self::Elem; }
Defines how to get the intrusive node from a particular kind of
SplayTree
's element type.
Don't implement this by hand -- doing so is both boring and dangerous!
Instead, use the impl_intrusive_node!
macro.
Associated Types
Required Methods
fn elem_to_node(_: &'a Self::Elem) -> &'a Node<'a>
Get the node for this tree from the given element.
unsafe fn node_to_elem(_: &'a Node<'a>) -> &'a Self::Elem
Get the element for this node (by essentially doing offsetof
the
node's field).
Safety
Given a node inside a different element type, or a node for a different tree within the same element type, this method will result in memory unsafety.