Struct stack_graphs::arena::ReversibleList [−][src]
#[repr(C)]pub struct ReversibleList<T> { /* fields omitted */ }
Expand description
An arena-allocated list that can be reversed.
Well, that is, you can reverse a List
just fine by yourself. This type takes care of
doing that for you, and importantly, saves the result so that if you only have to compute the
reversal once even if you need to access it multiple times.
Implementations
Creates a new ReversibleListArena
that will manage lists of this type.
Returns an empty list.
Returns whether we have already calculated the reversal of this list.
Pushes a new element onto the front of this list.
Removes and returns the element at the front of this list. If the list is empty, returns
None
.
Returns an iterator over the elements of this list.
Reverses the list. Since we’re already caching everything in an arena, we make sure to only calculate the reversal once, returning it as-is if you call this function multiple times.
Ensures that the reversal of this list is available. It can be useful to precalculate this when you have mutable access to the arena, so that you can then reverse and un-reverse the list later when you only have shared access to it.
Reverses the list, assuming that the reversal has already been computed. If it hasn’t we return an error.
pub fn equals_with<F>(
self,
arena: &ReversibleListArena<T>,
other: ReversibleList<T>,
eq: F
) -> bool where
F: FnMut(&T, &T) -> bool,
pub fn cmp_with<F>(
self,
arena: &ReversibleListArena<T>,
other: ReversibleList<T>,
cmp: F
) -> Ordering where
F: FnMut(&T, &T) -> Ordering,
Trait Implementations
type Output = MaybeUninit<Self>
type Output = MaybeUninit<Self>
The type that is used to store values of Self
inside of a ControlledOption
. This might
be Self
itself, if your niche is a valid instance of the type, but which violates some
runtime constraint. But if you cannot easily create your niche as an instance of Self
,
you can use some other type, you can use some other type instead. Read more
Returns the niche value for this type that should be used to represent None
for a
ControlledOption
. Read more
Returns whether value is the niche value for this type.
Transforms a non-niche value of this type into its Output
type. When Output
is Self
,
this will be the identity function. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for ReversibleList<T>
impl<T> Send for ReversibleList<T>
impl<T> Sync for ReversibleList<T>
impl<T> Unpin for ReversibleList<T> where
T: Unpin,
impl<T> UnwindSafe for ReversibleList<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more