Macro kernel::impl_list_arc_safe
source · macro_rules! impl_list_arc_safe { (impl$({$($generics:tt)*})? ListArcSafe<$num:tt> for $t:ty { untracked; } $($rest:tt)*) => { ... }; (impl$({$($generics:tt)*})? ListArcSafe<$num:tt> for $t:ty { tracked_by $field:ident : $fty:ty; } $($rest:tt)*) => { ... }; () => { ... }; }
Expand description
Declares that this type supports ListArc
.
This macro supports a few different strategies for implementing the tracking inside the type:
- The
untracked
strategy does not actually keep track of whether aListArc
exists. When using this strategy, the only way to create aListArc
is using aUniqueArc
. - The
tracked_by
strategy defers the tracking to a field of the struct. The user much specify which field to defer the tracking to. The field must implementListArcSafe
. If the field implementsTryNewListArc
, then the type will also implementTryNewListArc
.
The tracked_by
strategy is usually used by deferring to a field of type
AtomicTracker
. However, it is also possible to defer the tracking to another struct
using also using this macro.