Rust sys
Module Documentation
Module Overview
Provides a core set of built-in functions related to environment variable operations for managing the runtime environment.
help sys |
List of Environment Variable Related Functions
2. env
- Function: Get the list of variables in the top-level scope environment
- Parameters: None
- Return Value: A mapping structure of type
Environment
- Example:
(env)
→ Returns all bindings in the top-level scope
3. vars
- Function: Get the list of variables in the current environment
- Parameters: None
- Return Value: A hash table containing a mapping of
(variable name → value)
4. set
- Function: Define/modify a variable in the top-level scope
- Parameters:
(set name value)
name
: A string type variable namevalue
: Any expression
- Return Value:
Expression::None
- Error: Throws an exception if the number of parameters is not 2
5. unset
- Function: Remove the definition of a variable in the top-level scope
- Parameters:
(unset name)
name
: A string type variable name
- Return Value:
Expression::None
- Error: Throws an exception if the number of parameters is not 1
6. defined
- Function: Check if a variable is defined in the current and parent scopes
- Parameters:
(defined name)
name
: A string type variable name
- Return Value:
Boolean
type (true indicates defined) - Error: Throws an exception if the number of parameters is not 1
7. has
- Function: Check if a variable is defined in the current scope
- Parameters:
(has name)
name
: A string type variable name
- Return Value:
Boolean
type (true indicates defined) - Error: Throws an exception if the number of parameters is not 1
List of Environment Variable Related Functions
1. err_codes
- Function: Get the runtime error code table
- Parameters: None
- Return Value: A hash table containing a mapping of
(error code → description)
- Usage: Query error types during debugging
2. quote
- Function: Create a reference to an expression (prevent evaluation)
- Parameters:
(quote expr)
expr
: Any expression
- Return Value:
Quote
type (contains an immutable reference to the original expression) - Error: Throws an exception if the number of parameters is not 1
3. print_tty
- Function: Write control instructions to tty
- Parameters:
(print_tty expr)
String
: Character expression
- Return Value:
None
type - Error: Throws an exception if the number of parameters is not 1
4. discard
- Function: Send data to /dev/null
- Parameters:
(discard expr)
expr
: Any expression
- Return Value:
Quote
type (contains an immutable reference to the original expression)