[][src]Macro rc_dlist_deque::DlistImplSelector

macro_rules! DlistImplSelector {
    ($(+( $($typar:tt)* ))* $S:ty, $N:ty, $s:ident [ $($x:tt)* ]) => { ... };
}

DlistImplSelector!( [ +( TYPEPARAMS )] SELTYPE, NODE, SELVAR [ MEMBS ]);

For setting up nodes which can each be a member of multiple lists, where the link is identified at runtime.

(Usually when a node wants to potentially be a member of multiple lists, the specific list membership is known at compile time. In that case use DlistDefineStaticSelector if possible.)

Arranges that NODE can be part of a List by virtue of it containing a Link (or a particular collection of Links). (Implements Selector for SELTYPE.)

SELTYPE is a selector type (defined by you) which relates a node to one of its potential list memberships.

If +(TYPEPARAMS) is specified at the beginning, TYPEPARAMS is appended to impl in the macro expansion.

MEMBS is zero or more field selectors (each preceded by the .), array indices, etc., to find a Link inside NODE. In MEMBS, SELVAR (conventionally s), will be an immutable local variable of type SELTYPE. MEMBS must be surrounded by literal [ and ] for macro parsing reasons.

The macro constructs the expression (somenode MEMBS) where somenode is a reference to NODE, and expects that expression to name a Link<NODE,SELTYPE> within somenode. If this is not suitable, you should open-code an impleentation of Selector instead.

See the definition of List1Selector (in the source to this module), and its call to DlistImplSelector! for an example.

SELTYPE must be Copy. It is useful for it to be Debug, PartialEq, and SelectorFmt.