Struct conch_runtime::env::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 Rc internally. For a possible Send and Sync implementation, see atomic::Env.

Methods

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

[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 Env<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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<A, IO, FD, L, V, EX, WD, N, ERR> Debug for Env<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]

[src]

Formats the value using the given formatter.

impl<A, IO, FD, L, V, EX, WD, N, ERR> From<EnvConfig<A, IO, FD, L, V, EX, WD, N, ERR>> for Env<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]

[src]

Performs the conversion.

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

[src]

Indicates if running in interactive mode.

impl<A, IO, FD, L, V, EX, WD, N, ERR> SubEnvironment for Env<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]

[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 Env<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.

[src]

Get the name of the shell.

[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

[src]

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

[src]

Get all current arguments as a possibly owned slice.

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

A collection of arguments to set.

[src]

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 Env<A, IO, FD, L, V, EX, WD, N, ERR> where
    A: ShiftArgumentsEnvironment,
    N: Hash + Eq
[src]

[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 Env<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.

[src]

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

[src]

Creates a future for writing data into a FileDesc.

[src]

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 Env<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.

[src]

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

[src]

Associate a file descriptor with a given handle and permissions.

[src]

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

impl<A, IO, FD, L, V, EX, WD, N, ERR> ReportErrorEnvironment for Env<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]

[src]

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

impl<A, IO, FD, L, V, EX, WD, N, ERR> FunctionEnvironment for Env<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.

[src]

Get a particularly named function if it was registered.

[src]

Register a shell function with a given name.

[src]

Check if a particularly named function was registered.

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

[src]

Removes the definition of a function if it was registered.

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

[src]

Get the exit status of the previous command.

[src]

Set the exit status of the previously run command.

impl<A, IO, FD, L, V, EX, WD, N, ERR> VariableEnvironment for Env<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.

[src]

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

[src]

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

[src]

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 Env<A, IO, FD, L, V, EX, WD, N, ERR> where
    V: ExportedVariableEnvironment,
    N: Hash + Eq
[src]

[src]

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

[src]

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 Env<A, IO, FD, L, V, EX, WD, N, ERR> where
    V: UnsetVariableEnvironment,
    N: Hash + Eq
[src]

[src]

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

impl<A, IO, FD, L, V, EX, WD, N, ERR> ExecutableEnvironment for Env<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.

[src]

Attempt to spawn the executable command.

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

[src]

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

[src]

Retrieves the current working directory of this environment.

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

[src]

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