Struct conch_runtime::env::ArgsEnv
[−]
[src]
pub struct ArgsEnv<T> { /* fields omitted */ }
An environment module for setting and getting shell and function arguments.
Uses Rc
internally. For a possible Send
and Sync
implementation,
see env::atomic::ArgsEnv
.
Methods
impl<T> ArgsEnv<T>
[src]
fn new() -> Self where
T: From<String>,
[src]
T: From<String>,
Constructs a new environment and initializes it with the name of the current process as the shell name, and no arguments.
fn with_name(name: T) -> Self
[src]
Constructs a new environment and initializes it with the provided name and no arguments.
fn with_name_and_args<I: IntoIterator<Item = T>>(name: T, args: I) -> Self
[src]
Constructs a new environment and initializes it with the provided name and positional arguments.
Trait Implementations
impl<T: Debug> Debug for ArgsEnv<T>
[src]
impl<T: PartialEq> PartialEq for ArgsEnv<T>
[src]
fn eq(&self, __arg_0: &ArgsEnv<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &ArgsEnv<T>) -> bool
[src]
This method tests for !=
.
impl<T: Eq> Eq for ArgsEnv<T>
[src]
impl<T: From<String>> Default for ArgsEnv<T>
[src]
impl<T> Clone for ArgsEnv<T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> SubEnvironment for ArgsEnv<T>
[src]
fn sub_env(&self) -> Self
[src]
Create a new sub-environment, which starts out idential to its parent, but any changes on the new environment will not be reflected on the parent. Read more
impl<T: Clone> ArgumentsEnvironment for ArgsEnv<T>
[src]
type Arg = T
The type of arguments this environment holds.
fn name(&self) -> &Self::Arg
[src]
Get the name of the shell.
fn arg(&self, idx: usize) -> Option<&Self::Arg>
[src]
Get an argument at any index. Arguments are 1-indexed since the shell variable $0
refers to the shell's name. Thus the first real argument starts at index 1. Read more
fn args_len(&self) -> usize
[src]
Get the number of current arguments, NOT including the shell name.
fn args(&self) -> Cow<[Self::Arg]>
[src]
Get all current arguments as a possibly owned slice.
impl<T: Clone> SetArgumentsEnvironment for ArgsEnv<T>
[src]
type Args = Rc<Vec<T>>
A collection of arguments to set.
fn set_args(&mut self, new_args: Self::Args) -> Self::Args
[src]
Changes the environment's arguments to new_args
and returns the old arguments.
impl<T: Clone> ShiftArgumentsEnvironment for ArgsEnv<T>
[src]
fn shift_args(&mut self, amt: usize)
[src]
Shift parameters such that the positional parameter n
will hold the value of the positional parameter n + amt
. Read more