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
impl Stack
Sourcepub unsafe fn from_raw(top: *mut *mut StackNode, string_size: usize) -> Self
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.
Sourcepub fn string_size(&self) -> usize
pub fn string_size(&self) -> usize
The calling installer’s NSIS_MAX_STRLEN, in characters.
Sourcepub fn max_len(&self) -> usize
pub fn max_len(&self) -> usize
Longest string this installer can hold, excluding the NUL terminator.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the stack has no entries. Also true when there is no stack.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of entries currently on the stack.
Walks the whole list, so prefer is_empty in a loop.
Sourcepub fn pop(&mut self) -> Result<String>
pub fn pop(&mut self) -> Result<String>
Pops the top entry and frees its node, as popstring does.
Sourcepub fn pop_int(&mut self) -> Result<isize>
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.
Sourcepub fn pop_int_or(&mut self) -> Result<isize>
pub fn pop_int_or(&mut self) -> Result<isize>
Pops an integer, additionally accepting 2|4|8 forms, as popint_or.
Sourcepub fn push(&mut self, s: &str) -> Result<()>
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.