Struct iodyn::archive_stack::AStack
[−]
[src]
pub struct AStack<E: 'static + Debug + Clone + Eq + Hash, M: 'static + Debug + Clone + Eq + Hash> { /* fields omitted */ }
Incremental Archive Stack
Operations on a mutable vector, with a persistent stack of
vectors available. pop()
will open archives, but pushing to
the archive requires the archive()
method.
Parametric over elements, E
, and metadata M
, that will be
included with archived vectors. Metadata is currently only
available if the archive is accessed with next_archive()
Methods
impl<E: 'static + Debug + Clone + Eq + Hash, M: 'static + Debug + Clone + Eq + Hash> AStack<E, M>
[src]
fn new() -> Self
new AStack
with a new vector as current stack
fn with_capacity(capacity: usize) -> Self
new AStack
with a new pre-allocated vector as current stack
fn is_empty(&self) -> bool
whether or not the AStack
has any data, including archived data
fn active_len(&self) -> usize
the total item count of the AStack
, including archived data
fn name(&self) -> Option<Name>
get the incremental name of the archive, if it exists
fn push(&mut self, elm: E)
push a element to the "fast" vector outside of the archive
fn pop(&mut self) -> Option<E>
remove and return the element at the top of the stack, even if it is within the archive.
archive metadata is lost when opening an archive in this way
fn pop_meta(&mut self) -> Option<(E, Option<M>)>
remove and return the element at the top of the stack, even if it is withing the archive. If it was within the archive, return the metadata associated with that archive.
fn next_archive(&mut self) -> Option<(Vec<E>, Option<M>)>
Exposes the last data archived, returning the prior active vector and the metadata stored with the archive
fn active_data(&self) -> &Vec<E>
peeks at the entire active vector
fn peek(&self) -> Option<E>
peeks at the element at the top of the stack, even if it is within the archive.
peeking into the archive does not open it, so it will retain any associated metadata
fn archive(&mut self, name: Option<Name>, meta: M) -> bool
push the entire active vector into the archive, along with associated metadata return false if the active vector was empty. In this case, no archive will happen and the metadata will be unused
fn archive_with_capacity(
&mut self,
name: Option<Name>,
meta: M,
capacity: usize
) -> bool
&mut self,
name: Option<Name>,
meta: M,
capacity: usize
) -> bool
push the entire active vector into the archive, providing a capacity for the new active vector
Trait Implementations
impl<E: Debug + 'static + Debug + Clone + Eq + Hash, M: Debug + 'static + Debug + Clone + Eq + Hash> Debug for AStack<E, M>
[src]
impl<E: PartialEq + 'static + Debug + Clone + Eq + Hash, M: PartialEq + 'static + Debug + Clone + Eq + Hash> PartialEq for AStack<E, M>
[src]
fn eq(&self, __arg_0: &AStack<E, M>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &AStack<E, M>) -> bool
This method tests for !=
.
impl<E: Eq + 'static + Debug + Clone + Eq + Hash, M: Eq + 'static + Debug + Clone + Eq + Hash> Eq for AStack<E, M>
[src]
impl<E: Clone + 'static + Debug + Clone + Eq + Hash, M: Clone + 'static + Debug + Clone + Eq + Hash> Clone for AStack<E, M>
[src]
fn clone(&self) -> AStack<E, M>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<E: Hash + 'static + Debug + Clone + Eq + Hash, M: Hash + 'static + Debug + Clone + Eq + Hash> Hash for AStack<E, M>
[src]
fn hash<__HEM: Hasher>(&self, __arg_0: &mut __HEM)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<E: 'static + Debug + Clone + Eq + Hash, M: 'static + Debug + Clone + Eq + Hash> IntoIterator for AStack<E, M>
[src]
type Item = E
The type of the elements being iterated over.
type IntoIter = Iter<E, M>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<E: 'static + Debug + Clone + Eq + Hash> From<Vec<E>> for AStack<E, ()>
[src]
standard conversion, but no metadata will be included