[−][src]Struct nstack::NStack
A stack datastructure with indexed lookup.
Implementations
impl<T, A, H> NStack<T, A, H> where
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
[src]
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
pub fn new() -> Self
[src]
Creates a new empty NStack
pub fn push(&mut self, t: T) -> Result<()>
[src]
Pushes a new element onto the stack
pub fn pop(&mut self) -> Result<Option<T>>
[src]
Pop an element off the stack.
Returns the popped element, if any.
pub fn get<U>(&self, idx: U) -> Result<Option<Branch<Self, H>>> where
U: Counter,
Self::Annotation: Borrow<Cardinality<U>>,
[src]
U: Counter,
Self::Annotation: Borrow<Cardinality<U>>,
Get a branch pointing to the element stored at index idx
, if any
pub fn get_mut<U>(&mut self, idx: U) -> Result<Option<BranchMut<Self, H>>> where
U: Counter,
Self::Annotation: Borrow<Cardinality<U>>,
[src]
U: Counter,
Self::Annotation: Borrow<Cardinality<U>>,
Get a mutable branch pointing to the element stored at index idx
, if any
Trait Implementations
impl<T: Clone, A: Clone, H: Clone> Clone for NStack<T, A, H> where
T: Content<H>,
Self: Compound<H>,
H: ByteHash,
[src]
T: Content<H>,
Self: Compound<H>,
H: ByteHash,
impl<T, A, H> Compound<H> for NStack<T, A, H> where
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
[src]
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
type Leaf = T
The leaf type of the compound structure
type Annotation = A
The node-annotation type
fn children(&self) -> &[Handle<Self, H>]
[src]
fn children_mut(&mut self) -> &mut [Handle<Self, H>]
[src]
fn annotation(&self) -> Option<Self::Annotation>
[src]
fn search<M>(&self, m: &mut M) -> Result<Option<Branch<Self, H>>, Error> where
M: Method<Self, H>,
[src]
M: Method<Self, H>,
fn search_mut<M>(
&mut self,
m: &mut M
) -> Result<Option<BranchMut<Self, H>>, Error> where
M: Method<Self, H>,
[src]
&mut self,
m: &mut M
) -> Result<Option<BranchMut<Self, H>>, Error> where
M: Method<Self, H>,
fn root_hash(&mut self) -> <H as ByteHash>::Digest
[src]
impl<T, A, H> Content<H> for NStack<T, A, H> where
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
[src]
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
fn persist(&mut self, sink: &mut Sink<H>) -> Result<()>
[src]
fn restore(source: &mut Source<H>) -> Result<Self>
[src]
impl<T, A, H> Default for NStack<T, A, H> where
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
[src]
T: Content<H>,
A: Content<H> + Annotation<T, H>,
H: ByteHash,
Auto Trait Implementations
impl<T, A, H> !RefUnwindSafe for NStack<T, A, H>
impl<T, A, H> !Send for NStack<T, A, H>
impl<T, A, H> !Sync for NStack<T, A, H>
impl<T, A, H> !Unpin for NStack<T, A, H>
impl<T, A, H> !UnwindSafe for NStack<T, A, H>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<C, H> CorrectEmptyState<H> for C where
C: Compound<H>,
H: ByteHash,
[src]
C: Compound<H>,
H: ByteHash,
fn assert_correct_empty_state(&self)
[src]
impl<T> Erased for T
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<C, H> LeafIterable<H> for C where
C: Compound<H>,
H: ByteHash,
[src]
C: Compound<H>,
H: ByteHash,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<C, V, H> ValIterable<V, H> for C where
C: Compound<H>,
H: ByteHash,
[src]
C: Compound<H>,
H: ByteHash,