Skip to main content

Variables

Struct Variables 

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

Handle to the installer’s variables array.

Implementations§

Source§

impl Variables

Source

pub unsafe fn from_raw(base: *mut Tchar, string_size: usize) -> Self

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

§Safety

base must be the variables pointer the installer passed, pointing at VAR_COUNT × string_size characters, and must outlive the result.

Source

pub fn string_size(&self) -> usize

The calling installer’s NSIS_MAX_STRLEN, in characters.

Source

pub fn get(&self, var: Var) -> String

Reads a variable.

Returns an empty string when the installer passed no variables array, because there is nothing sensible to read and $0 is empty by default.

Source

pub fn set(&mut self, var: Var, value: &str) -> Result<()>

Writes a variable, bounded by the installer’s string_size.

setuservariable uses an unbounded lstrcpy here, which overflows the slot for a long enough value; this bounds the copy and reports Error::Truncated instead.

Source

pub fn get_int(&self, var: Var) -> isize

Reads a variable using NSIS’s own integer conversion.

Source

pub fn set_int(&mut self, var: Var, value: isize) -> Result<()>

Writes an integer to a variable, formatted as pushintptr formats it.

Auto Trait Implementations§

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.