Skip to main content

Stack

Struct Stack 

Source
pub struct Stack { /* private fields */ }
Expand description

Handle to the installer’s stack_t **.

Obtained from Nsis::stack; not constructed directly outside of tests.

Implementations§

Source§

impl Stack

Source

pub unsafe fn from_raw(top: *mut *mut StackNode, string_size: usize) -> Self

Wraps the stacktop and string_size arguments of a plug-in export.

§Safety

top must be the stacktop pointer the installer passed, and string_size its string_size argument. The stack must outlive the returned value.

Source

pub fn string_size(&self) -> usize

The calling installer’s NSIS_MAX_STRLEN, in characters.

Source

pub fn max_len(&self) -> usize

Longest string this installer can hold, excluding the NUL terminator.

Source

pub fn is_empty(&self) -> bool

Whether the stack has no entries. Also true when there is no stack.

Source

pub fn len(&self) -> usize

Number of entries currently on the stack.

Walks the whole list, so prefer is_empty in a loop.

Source

pub fn pop(&mut self) -> Result<String>

Pops the top entry and frees its node, as popstring does.

Source

pub fn peek(&self) -> Result<String>

Reads the top entry without removing it.

Source

pub fn discard(&mut self) -> Result<()>

Pops and discards the top entry.

Source

pub fn pop_int(&mut self) -> Result<isize>

Pops an integer using NSIS’s own conversion.

Unparseable input is 0, not an error — this matches popintptr, and scripts rely on it. Only an empty stack is an error.

Source

pub fn pop_int_or(&mut self) -> Result<isize>

Pops an integer, additionally accepting 2|4|8 forms, as popint_or.

Source

pub fn push(&mut self, s: &str) -> Result<()>

Pushes a string, bounded by the installer’s string_size.

On Error::Truncated the clipped value has still been pushed, exactly as lstrcpyn would leave it. The error exists so the caller can decide whether the truncation matters.

Source

pub fn push_int(&mut self, value: isize) -> Result<()>

Pushes an integer, formatted as pushintptr formats it.

Source

pub fn push_bool(&mut self, value: bool) -> Result<()>

Pushes a boolean as the 0/1 NSIS scripts compare against.

Auto Trait Implementations§

§

impl !Send for Stack

§

impl !Sync for Stack

§

impl Freeze for Stack

§

impl RefUnwindSafe for Stack

§

impl Unpin for Stack

§

impl UnsafeUnpin 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.