Skip to main content

ParamTable

Struct ParamTable 

Source
pub struct ParamTable {
Show 46 fields pub local_level: i32, pub histchars: [u8; 3], pub lastval: i64, pub mypid: i64, pub lastpid: i64, pub curhist: i64, pub lineno: i64, pub ppid: i64, pub zsh_subshell: i64, pub columns: i64, pub lines: i64, pub shlvl: i64, pub funcnest: i64, pub optind: i64, pub optarg: String, pub try_errflag: i64, pub try_interrupt: i64, pub rprompt_indent: i64, pub ifs: String, pub underscore: String, pub pparams: Vec<String>, pub argzero: String, pub posixzero: String, pub pipestats: Vec<i32>, pub prompt: String, pub prompt2: String, pub prompt3: String, pub prompt4: String, pub rprompt: String, pub rprompt2: String, pub sprompt: String, pub nullcmd: String, pub readnullcmd: String, pub postedit: String, pub wordchars: String, pub keyboard_hack_char: u8, pub home: String, pub term: String, pub terminfo: String, pub terminfo_dirs: String, pub tied: HashMap<String, TiedData>, pub histsize: i64, pub savehist: i64, pub ksh_arrays: bool, pub posix_argzero: bool, pub zsh_eval_context: Vec<String>, /* private fields */
}

Fields§

§local_level: i32§histchars: [u8; 3]

Shell histchars: [bangchar, hatchar, hashchar]

§lastval: i64

Last exit status ($?)

§mypid: i64

PID ($$)

§lastpid: i64

Last background PID ($!)

§curhist: i64

Current history command number

§lineno: i64

Current line number ($LINENO)

§ppid: i64

Parent PID ($PPID)

§zsh_subshell: i64

Subshell nesting ($ZSH_SUBSHELL)

§columns: i64

Terminal columns ($COLUMNS)

§lines: i64

Terminal lines ($LINES)

§shlvl: i64

$SHLVL

§funcnest: i64

Max function nesting ($FUNCNEST)

§optind: i64

$OPTIND

§optarg: String

$OPTARG

§try_errflag: i64

TRY_BLOCK_ERROR

§try_interrupt: i64

TRY_BLOCK_INTERRUPT

§rprompt_indent: i64

ZLE_RPROMPT_INDENT

§ifs: String

IFS value

§underscore: String

Underscore ($_)

§pparams: Vec<String>

Positional parameters ($1, $2, …)

§argzero: String

$0

§posixzero: String

Positional zero for POSIX

§pipestats: Vec<i32>

$pipestatus

§prompt: String

Prompt strings

§prompt2: String§prompt3: String§prompt4: String§rprompt: String§rprompt2: String§sprompt: String§nullcmd: String

NULLCMD / READNULLCMD

§readnullcmd: String§postedit: String

POSTEDIT

§wordchars: String

WORDCHARS

§keyboard_hack_char: u8

KEYBOARD_HACK

§home: String

HOME

§term: String

TERM

§terminfo: String

TERMINFO

§terminfo_dirs: String

TERMINFO_DIRS

§tied: HashMap<String, TiedData>

Tied parameter bindings

§histsize: i64

HISTSIZE

§savehist: i64

SAVEHIST

§ksh_arrays: bool

Options state for KSH_ARRAYS etc.

§posix_argzero: bool

Options state for POSIX_ARGZERO

§zsh_eval_context: Vec<String>

Eval context stack

Implementations§

Source§

impl ParamTable

Source

pub fn new() -> Self

Source

pub fn get_random(&self) -> i64

Source

pub fn get_seconds_int(&self) -> i64

Source

pub fn get_seconds_float(&self) -> f64

Source

pub fn get_seconds(&self) -> f64

Get the SECONDS value

Source

pub fn set_seconds_type(&mut self, is_float: bool)

Source

pub fn get(&self, name: &str) -> Option<&ParamValue>

Get a parameter value, resolving specials and namerefs

Source

pub fn get_value(&self, name: &str) -> Option<ParamValue>

Get a parameter value, including dynamic specials

Source

pub fn get_param(&self, name: &str) -> Option<&Param>

Get the full parameter struct

Source

pub fn get_param_mut(&mut self, name: &str) -> Option<&mut Param>

Get mutable parameter

Source

pub fn set_scalar(&mut self, name: &str, value: &str) -> bool

Set a scalar parameter

Source

pub fn set_integer(&mut self, name: &str, value: i64) -> bool

Set an integer parameter

Source

pub fn set_float(&mut self, name: &str, value: f64) -> bool

Set a float parameter

Source

pub fn set_array(&mut self, name: &str, value: Vec<String>) -> bool

Set an array parameter

Source

pub fn set_assoc(&mut self, name: &str, value: HashMap<String, String>) -> bool

Set an associative array parameter

Source

pub fn set_numeric(&mut self, name: &str, val: MNumber) -> bool

Set a numeric value (MNumber)

Source

pub fn augment_scalar(&mut self, name: &str, value: &str) -> bool

Augmented assignment (+=)

Source

pub fn augment_array(&mut self, name: &str, value: Vec<String>) -> bool

Augmented assignment for arrays (+=)

Source

pub fn augment_integer(&mut self, name: &str, value: i64) -> bool

Augmented assignment for integers (+=)

Source

pub fn unset(&mut self, name: &str) -> bool

Unset a parameter

Source

pub fn export(&mut self, name: &str) -> bool

Export a parameter

Source

pub fn unexport(&mut self, name: &str)

Unexport a parameter

Source

pub fn set_readonly(&mut self, name: &str) -> bool

Mark parameter as readonly

Source

pub fn push_scope(&mut self)

Start a new local scope

Source

pub fn pop_scope(&mut self)

End a local scope, restoring parameters

Source

pub fn make_local(&mut self, name: &str)

Create a local variable (from typeset/local builtin)

Source

pub fn make_local_typed(&mut self, name: &str, pm_flags: u32)

Create a local variable with a specific type

Source

pub fn createparam(&mut self, name: &str, pm_flags: u32) -> bool

Create a parameter with given flags. Returns false if already exists and set.

Source

pub fn resetparam(&mut self, name: &str, new_flags: u32) -> bool

Reset parameter to new type (from resetparam in C)

Source

pub fn set_nameref(&mut self, name: &str, target: &str) -> bool

Create a named reference

Source

pub fn resolve_nameref<'a>(&'a self, name: &str) -> Option<&'a Param>

Resolve a nameref to its ultimate target Param

Source

pub fn set_loop_var(&mut self, name: &str, value: &str)

Set loop variable (for-loop nameref support)

Source

pub fn tie_param(&mut self, scalar: &str, array: &str, sep: char)

Tie scalar to array with separator (from typeset -T)

Source

pub fn untie_param(&mut self, name: &str)

Untie a parameter pair

Source

pub fn set_array_element(&mut self, name: &str, index: i64, value: &str) -> bool

Set array element by index (1-based, zsh style)

Source

pub fn get_array_element(&self, name: &str, index: i64) -> Option<String>

Get array element by index (1-based, zsh style)

Source

pub fn set_hash_element(&mut self, name: &str, key: &str, value: &str) -> bool

Set associative array element

Source

pub fn get_hash_element(&self, name: &str, key: &str) -> Option<String>

Get associative array element

Source

pub fn unset_hash_element(&mut self, name: &str, key: &str) -> bool

Delete associative array element

Source

pub fn get_hash_keys(&self, name: &str) -> Vec<String>

Get all keys from associative array

Source

pub fn get_hash_values(&self, name: &str) -> Vec<String>

Get all values from associative array

Source

pub fn get_array_slice(&self, name: &str, start: i64, end: i64) -> Vec<String>

Get array slice with subscript handling

Source

pub fn set_array_slice( &mut self, name: &str, start: i64, end: i64, val: Vec<String>, ) -> bool

Set array slice with subscript handling

Source

pub fn get_str_slice(&self, name: &str, start: i64, end: i64) -> String

Get string slice

Source

pub fn set_str_slice( &mut self, name: &str, start: i64, end: i64, val: &str, ) -> bool

Set string slice

Source

pub fn export_param(&mut self, name: &str)

Export parameter to environment (full version from export_param)

Source

pub fn arr_fix_env(&mut self, name: &str)

Fix environment after array change (from arrfixenv)

Source

pub fn iter(&self) -> impl Iterator<Item = (&String, &Param)>

Iterate over all parameters

Source

pub fn contains(&self, name: &str) -> bool

Check if a parameter exists (and is set)

Source

pub fn len(&self) -> usize

Get parameter count

Source

pub fn is_empty(&self) -> bool

Source

pub fn scan_match<F>(&self, pattern: &str, flag_filter: u32, callback: F)
where F: FnMut(&str, &Param),

Scan parameters matching pattern with optional flag filter

Source

pub fn paramnames(&self, pattern: Option<&str>) -> Vec<String>

Get all parameter names matching pattern

Source

pub fn format_param(&self, name: &str, pf: u32) -> Option<String>

Format a parameter for display (typeset -p output)

Source

pub fn getparamtype(&self, name: &str) -> &'static str

Get parameter type string (from getparamtype)

Source

pub fn issetvar(&self, name: &str) -> bool

Check if parameter is set (from issetvar)

Source

pub fn arrlen(&self, name: &str) -> usize

Get array length (from arrlen)

Source

pub fn isarray(&self, name: &str) -> bool

Check if parameter is an array

Source

pub fn ishash(&self, name: &str) -> bool

Check if parameter is a hash

Source

pub fn copyparam(&self, name: &str) -> Option<ParamValue>

Copy a parameter value

Trait Implementations§

Source§

impl Default for ParamTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more