Stack

Struct Stack 

Source
pub struct Stack {
    pub s: Vec<f64>,
    /* private fields */
}
Expand description

Stack is a type representing a stack in *><>. It holds the stack values in s, as well as a register. The register may contain data, but will only be considered filled if filled_register is also true.

Fields§

§s: Vec<f64>

Implementations§

Source§

impl Stack

Source

pub fn new(s: Option<Vec<f64>>) -> Stack

Source

pub fn from_string(str_stack: &str) -> Result<Stack, Box<dyn Error>>

Source

pub fn to_string(&self) -> String

output information about the stack

Source

pub fn push(&mut self, r: f64)

push r to the end of the stack

Source

pub fn pop(&mut self) -> f64

pop a value from the end of the stack, and return it

Source

pub fn register(&mut self)

register implements “&”.

Source

pub fn extend(&mut self)

extend implements “:”.

Source

pub fn reverse(&mut self)

reverse implements “r”.

Source

pub fn swap_two(&mut self)

swap_two implements “$”.

Source

pub fn swap_three(&mut self)

swap_three implements “@”: with [1,2,3,4], calling “@” results in [1,4,2,3].

Source

pub fn shift_right(&mut self)

shift_right implements “}”.

Source

pub fn shift_left(&mut self)

shift_left implements “{”.

Source

pub fn get_bytes(&mut self, count: usize) -> Vec<u8>

get_bytes removes c values from the stack, then returns them as a byte vector.

Auto Trait Implementations§

§

impl Freeze for Stack

§

impl RefUnwindSafe for Stack

§

impl Send for Stack

§

impl Sync for Stack

§

impl Unpin for Stack

§

impl UnwindSafe for Stack

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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.

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V