Skip to main content

Environment

Struct Environment 

Source
pub struct Environment {
    pub condition_info: Option<ConditionInfoData>,
    /* private fields */
}
Expand description

A variable environment (scope).

Fields§

§condition_info: Option<ConditionInfoData>

Most recent condition trap info (for CONDITION() BIF).

Implementations§

Source§

impl Environment

Source

pub fn new() -> Self

Source

pub fn get(&self, name: &str) -> RexxValue

Get a simple variable’s value. In REXX, an unset variable returns its own name in uppercase.

REXX scoping: PROCEDURE creates an opaque wall. Only the current (topmost) scope is searched. EXPOSE copies specific variables into the new scope — that’s the only way through.

Source

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

Set a simple variable.

Source

pub fn get_compound(&self, stem: &str, resolved_tail: &str) -> RexxValue

Get a compound variable: stem.tail The tail components are resolved (each variable in the tail is looked up) and concatenated with dots.

Source

pub fn set_compound( &mut self, stem: &str, resolved_tail: &str, value: RexxValue, )

Set a compound variable.

Source

pub fn set_stem_default(&mut self, stem: &str, value: RexxValue)

Set the default value for a stem (e.g., stem. = 0).

Source

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

DROP a variable — restore it to its uninitialized state.

Source

pub fn push_procedure(&mut self)

PROCEDURE — push a new empty scope.

Source

pub fn push_procedure_expose(&mut self, names: &[String])

PROCEDURE EXPOSE — push a new scope that shares specified variables.

Source

pub fn pop_procedure(&mut self)

Pop the current scope (on RETURN from a PROCEDURE). Writes back any exposed variables to the parent scope.

Source

pub fn address(&self) -> &str

Return the current default ADDRESS environment name.

Source

pub fn set_address(&mut self, env: &str)

Set a new default ADDRESS environment, saving the old as previous.

Source

pub fn swap_address(&mut self)

Swap default ↔ previous ADDRESS environment.

Source

pub fn set_source_path(&mut self, path: PathBuf)

Set the source file path (for external function resolution and PARSE SOURCE).

Source

pub fn clear_source_path(&mut self)

Clear the source file path (restores REPL/no-file state).

Source

pub fn source_path(&self) -> Option<&Path>

Get the source file path.

Source

pub fn source_dir(&self) -> Option<&Path>

Get the directory containing the source file.

Source

pub fn set_condition_info(&mut self, info: ConditionInfoData)

Set condition info (called when a trap fires).

Source

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

Check if a simple variable has been explicitly set (for SIGNAL ON NOVALUE).

Source

pub fn is_compound_set(&self, stem: &str, resolved_tail: &str) -> bool

Check if a compound variable has been explicitly set (for SIGNAL ON NOVALUE). Returns true if the specific tail has a value OR the stem has a default.

Trait Implementations§

Source§

impl Clone for Environment

Source§

fn clone(&self) -> Environment

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Environment

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Environment

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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