pub trait Types {
type Id: Id;
type Protected;
type Removed;
type Unprotected;
}Expand description
Types used in a PinList. This trait is used to avoid an excessive number of generic
parameters on PinList and related types.
Generally you won’t want to implement this trait directly — instead you can create ad-hoc
implementations by using dyn Trait syntax, for example:
type PinListTypes = dyn pin_list::Types<
Id = pin_list::id::Checked,
Protected = (),
Removed = (),
Unprotected = (),
>;
type PinList = pin_list::PinList<PinListTypes>;Required Associated Types§
Sourcetype Id: Id
type Id: Id
The ID type this list uses to ensure that different PinLists are not mixed up.
This crate provides a couple built-in ID types, but you can also define your own:
id::Checked: IDs are allocated with a single global atomicu64counter.id::Unchecked: The responsibility is left up to the user to ensure that differentPinLists are not incorrectly mixed up. Using this isunsafe.id::DebugChecked: Equivalent toid::Checkedwhendebug_assertionsare enabled, butid::Uncheckedin release.id::Lifetime: A fully statically checked ID based on invariant lifetimes and HRTBs — this is the same technique as used byGhostCell. While theoretically the best option, its infectious nature makes it not very useful in practice.
Sourcetype Protected
type Protected
Data owned by each node in the list (before it has been removed) and protected by the list. This is only accessible when the list is.
When the node is removed from the list, this value is replaced with Removed.
Sourcetype Unprotected
type Unprotected
Data owned by each node in the list but not protected by the list.
This is always accessible by shared reference from the node itself without accessing the
list, and is acessible by shared reference from the PinList.