Struct conch_runtime::env::atomic::Env[][src]

pub struct Env<A, IO, FD, L, V, EX, WD, N: Eq + Hash, ERR> { /* fields omitted */ }

A shell environment implementation which delegates work to other environment implementations.

Uses Arc internally. If Send and Sync is not required of the implementation, see Env as a cheaper alternative.

Methods

impl<A, IO, FD, L, V, EX, WD, N, ERR> AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    N: Hash + Eq
[src]

Creates an environment using the provided configuration of subcomponents.

See EnvConfig for the kinds of overrides possible. DefaultEnvConfig comes with provided implementations to get you up and running.

General recommendations:

  • The result of evaluating a shell word will often be copied and reused in many different places. It's strongly recommened that Rc or Arc wrappers (e.g. Rc<String>) be used to minimize having to reallocate and copy the same data.
  • Whatever type represents a shell function body needs to be cloned to get around borrow restrictions and potential recursive executions and (re-)definitions. Since this type is probably an AST (which may be arbitrarily large), Rc and Arc are your friends.

Trait Implementations

impl<A, IO, FD, L, V, EX, WD, N, ERR> Clone for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: Clone,
    FD: Clone,
    L: Clone,
    V: Clone,
    N: Hash + Eq,
    IO: Clone,
    EX: Clone,
    WD: Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<A, IO, FD, L, V, EX, WD, N, ERR> Debug for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: Debug,
    FD: Debug,
    L: Debug,
    V: Debug,
    N: Hash + Eq + Ord + Debug,
    IO: Debug,
    EX: Debug,
    WD: Debug
[src]

Formats the value using the given formatter. Read more

impl<A, IO, FD, L, V, EX, WD, N, ERR> From<EnvConfig<A, IO, FD, L, V, EX, WD, N, ERR>> for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    N: Hash + Eq,
    V: ExportedVariableEnvironment,
    V::VarName: From<String>,
    V::Var: Borrow<String> + From<String>, 
[src]

Performs the conversion.

impl<A, IO, FD, L, V, EX, WD, N, ERR> IsInteractiveEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    N: Hash + Eq
[src]

Indicates if running in interactive mode.

impl<A, IO, FD, L, V, EX, WD, N, ERR> SubEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: SubEnvironment,
    FD: SubEnvironment,
    L: SubEnvironment,
    V: SubEnvironment,
    N: Hash + Eq,
    IO: SubEnvironment,
    EX: SubEnvironment,
    WD: SubEnvironment
[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<A, IO, FD, L, V, EX, WD, N, ERR> ArgumentsEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: ArgumentsEnvironment,
    A::Arg: Clone,
    N: Hash + Eq
[src]

The type of arguments this environment holds.

Get the name of the shell.

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

Get the number of current arguments, NOT including the shell name.

Get all current arguments as a possibly owned slice.

impl<A, IO, FD, L, V, EX, WD, N, ERR> SetArgumentsEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: SetArgumentsEnvironment,
    N: Hash + Eq
[src]

A collection of arguments to set.

Changes the environment's arguments to new_args and returns the old arguments.

impl<A, IO, FD, L, V, EX, WD, N, ERR> ShiftArgumentsEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: ShiftArgumentsEnvironment,
    N: Hash + Eq
[src]

Shift parameters such that the positional parameter n will hold the value of the positional parameter n + amt. Read more

impl<A, IO, FD, L, V, EX, WD, N, ERR> AsyncIoEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    IO: AsyncIoEnvironment,
    N: Hash + Eq
[src]

An async/futures-aware Read adapter around a FileDesc.

An future that represents writing data into a FileDesc.

Creates a futures-aware adapter to read data from a FileDesc asynchronously.

Creates a future for writing data into a FileDesc.

Asynchronously write the contents of data to a FileDesc in the background on a best effort basis (e.g. the implementation can give up due to any (appropriately) unforceen errors like broken pipes). Read more

impl<A, IO, FD, L, V, EX, WD, N, ERR> FileDescEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    FD: FileDescEnvironment,
    N: Hash + Eq
[src]

A file handle (or wrapper) to associate with shell file descriptors.

Get the permissions and a handle associated with an opened file descriptor.

Associate a file descriptor with a given handle and permissions.

Treat the specified file descriptor as closed for the current environment.

impl<A, IO, FD, L, V, EX, WD, N, ERR> ReportErrorEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: ArgumentsEnvironment,
    A::Arg: Display,
    FD: FileDescEnvironment,
    FD::FileHandle: Borrow<FileDesc>,
    N: Hash + Eq
[src]

Reports any Error as appropriate, e.g. print to stderr.

impl<A, IO, FD, L, V, EX, WD, N, ERR> FunctionEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    N: Hash + Eq + Clone
[src]

The name to be associated with a function.

The type of the function.

Get a particularly named function if it was registered.

Register a shell function with a given name.

Check if a particularly named function was registered.

impl<A, IO, FD, L, V, EX, WD, N, ERR> UnsetFunctionEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    N: Hash + Eq + Clone
[src]

Removes the definition of a function if it was registered.

impl<A, IO, FD, L, V, EX, WD, N, ERR> LastStatusEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    L: LastStatusEnvironment,
    N: Hash + Eq
[src]

Get the exit status of the previous command.

Set the exit status of the previously run command.

impl<A, IO, FD, L, V, EX, WD, N, ERR> VariableEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    V: VariableEnvironment,
    N: Hash + Eq
[src]

The type of the name this environment associates for a variable.

The type of variables this environment holds.

Get the value of some variable. The values of both shell-only and environment variables will be looked up and returned. Read more

Set the value of some variable, maintaining its status as an environment variable if previously set as such. Read more

Unset the value of some variable (including environment variables). Get all current pairs of environment variables and their values. Read more

impl<A, IO, FD, L, V, EX, WD, N, ERR> ExportedVariableEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    V: ExportedVariableEnvironment,
    N: Hash + Eq
[src]

Get the value of some variable and whether it is exported.

Set the value of some variable, and set it's exported status as specified.

impl<A, IO, FD, L, V, EX, WD, N, ERR> UnsetVariableEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    V: UnsetVariableEnvironment,
    N: Hash + Eq
[src]

Unset the value of some variable (including environment variables).

impl<A, IO, FD, L, V, EX, WD, N, ERR> ExecutableEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    V: UnsetVariableEnvironment,
    N: Hash + Eq,
    EX: ExecutableEnvironment
[src]

A future which will resolve to the executable's exit status.

Attempt to spawn the executable command.

impl<A, IO, FD, L, V, EX, WD, N, ERR> WorkingDirectoryEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    N: Hash + Eq,
    WD: WorkingDirectoryEnvironment
[src]

Converts the specified path to one relative to the environment's working directory.

Retrieves the current working directory of this environment.

impl<A, IO, FD, L, V, EX, WD, N, ERR> ChangeWorkingDirectoryEnvironment for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    N: Hash + Eq,
    WD: ChangeWorkingDirectoryEnvironment
[src]

Changes the environment's current working directory to the following path. Read more

Auto Trait Implementations

impl<A, IO, FD, L, V, EX, WD, N, ERR> Send for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: Send,
    EX: Send,
    FD: Send,
    IO: Send,
    L: Send,
    N: Send + Sync,
    V: Send,
    WD: Send

impl<A, IO, FD, L, V, EX, WD, N, ERR> Sync for AtomicEnv<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: Sync,
    EX: Sync,
    FD: Sync,
    IO: Sync,
    L: Sync,
    N: Send + Sync,
    V: Sync,
    WD: Sync