[][src]Trait intrusive_splay_tree::IntrusiveNode

pub unsafe trait IntrusiveNode<'a> where
    Self: Sized
{ type Elem: TreeOrd<'a, Self>; fn elem_to_node(elem: &'a Self::Elem) -> &'a Node<'a>;
unsafe fn node_to_elem(node: &'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

type Elem: TreeOrd<'a, Self>

The element struct type that contains a node for this tree.

Loading content...

Required methods

fn elem_to_node(elem: &'a Self::Elem) -> &'a Node<'a>

Get the node for this tree from the given element.

unsafe fn node_to_elem(node: &'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.

Loading content...

Implementors

Loading content...