Struct knightrs::environment::Builder[][src]

pub struct Builder<'i, 'o, 'c> { /* fields omitted */ }

A Builder for the Environment struct.

Implementations

impl<'i, 'o, 'c> Builder<'i, 'o, 'c>[src]

#[must_use = "creating a builder does nothing by itself."]
pub fn new() -> Self
[src]

Creates a new, default Builder.

#[must_use = "assigning a capacity does nothing without calling 'build'."]
pub fn capacity(self, capacity: usize) -> Self
[src]

Sets the initial starting capacity for the set of Variables.

If not set, an (unspecified) default capacity is used.

#[must_use = "assigning to stdin does nothing without calling 'build'."]
pub fn stdin(self, stdin: &'i mut dyn Read) -> Self
[src]

Sets the stdin for the Environment.

This defaults to the stdin of the process.

#[must_use = "assigning to stdout does nothing without calling 'build'."]
pub fn stdout(self, stdout: &'o mut dyn Write) -> Self
[src]

Sets the stdout for the Environment.

This defaults to the stdout of the process.

#[must_use = "assigning a 'system' does nothing without calling 'build'."]
pub fn system(
    self,
    system: &'c mut dyn FnMut(&str) -> Result<Text, Error>
) -> Self
[src]

Explicitly sets what should happen when the “system” (`) function is called.

The default value is to simply send the command to sh (ie "sh", "-c", "command")

#[must_use = "disabling the system command to does nothing without calling 'build'."]
pub fn disable_system(self) -> Self
[src]

Disables the “system” (`) command entirely.

When this is enabled, all calls to ` will return errors.

#[must_use = "Simply calling `build` does nothing on its own."]
pub fn build(self) -> Environment<'i, 'o, 'c>

Notable traits for Environment<'_, '_, '_>

impl Read for Environment<'_, '_, '_>impl Write for Environment<'_, '_, '_>
[src]

Creates a new Environment with all the supplied options.

Any options that have not been explicitly set will have their default values used.

Trait Implementations

impl<'i, 'o, 'c> Default for Builder<'i, 'o, 'c>[src]

Auto Trait Implementations

impl<'i, 'o, 'c> !RefUnwindSafe for Builder<'i, 'o, 'c>

impl<'i, 'o, 'c> !Send for Builder<'i, 'o, 'c>

impl<'i, 'o, 'c> !Sync for Builder<'i, 'o, 'c>

impl<'i, 'o, 'c> Unpin for Builder<'i, 'o, 'c>

impl<'i, 'o, 'c> !UnwindSafe for Builder<'i, 'o, 'c>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,