Struct sprs::stack::DStack

source ·
pub struct DStack<I> { /* private fields */ }
Expand description

A double stack of fixed capacity, growing from the left to the right or conversely.

Used in sparse triangular / sparse vector solves, where it is guaranteed that the two parts of the stack cannot overlap.

Implementations§

source§

impl<I> DStack<I>where I: Clone,

source

pub fn with_capacity(n: usize) -> Selfwhere I: Default,

Create a new double stacked suited for containing at most n elements

source

pub fn capacity(&self) -> usize

Capacity of the dstack

source

pub fn is_left_empty(&self) -> bool

Test whether the left stack is empty

source

pub fn is_right_empty(&self) -> bool

Test whether the right stack is empty

source

pub fn push_left(&mut self, value: I)

Push a value on the left stack

source

pub fn push_right(&mut self, value: I)

Push a value on the right stack

source

pub fn pop_left(&mut self) -> Option<I>

Pop a value from the left stack

source

pub fn pop_right(&mut self) -> Option<I>

Pop a value from the right stack

source

pub fn len_right(&self) -> usize

Number of right elements this double stack contains

source

pub fn clear_right(&mut self)

Clear the right stack

source

pub fn clear_left(&mut self)

Clear the left stack

source

pub fn iter_right(&self) -> Iter<'_, I>

Iterates along the right stack without removing items

source

pub fn push_left_on_right(&mut self)

Push the values of the left stack onto the right stack.

source

pub fn push_right_on_left(&mut self)

Push the values of the right stack onto the left stack.

Trait Implementations§

source§

impl<I: Clone> Clone for DStack<I>

source§

fn clone(&self) -> DStack<I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Debug> Debug for DStack<I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for DStack<I>where I: RefUnwindSafe,

§

impl<I> Send for DStack<I>where I: Send,

§

impl<I> Sync for DStack<I>where I: Sync,

§

impl<I> Unpin for DStack<I>where I: Unpin,

§

impl<I> UnwindSafe for DStack<I>where I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.