Skip to main content

InputResolveExt

Trait InputResolveExt 

Source
pub trait InputResolveExt<T> {
    // Required methods
    fn env_names(&self) -> Vec<&'static str>;
    fn get(&self) -> Option<T>;
    fn get_in(&self, env: &impl EnvSource) -> Option<T>;
    fn get_from(&self, resolution: &Resolution) -> Option<T>;
    fn is_set(&self) -> bool;
    fn is_set_in(&self, env: &impl EnvSource) -> bool;
    fn raw(&self) -> Option<String>;
    fn raw_in(&self, env: &impl EnvSource) -> Option<String>;
}
Expand description

Runtime-reading methods for Input, added by this crate.

Implemented for every Input<T, C> whose T implements FromRaw — which is every Input that could ever have a value read out of it. use argenv_resolve::*; brings this into scope automatically; you will not usually name it directly, just call .get_from(&resolution) etc.

Required Methods§

Source

fn env_names(&self) -> Vec<&'static str>

Every environment name this input answers to.

Source

fn get(&self) -> Option<T>

Read and parse from the process environment. None means absent or invalid — never a silent empty string.

Source

fn get_in(&self, env: &impl EnvSource) -> Option<T>

Read and parse from env.

Use this to check an environment being assembled for a child process, to read a snapshot captured elsewhere, or to test without mutating global process state.

Source

fn get_from(&self, resolution: &Resolution) -> Option<T>

Read and parse from a resolved invocation, honouring precedence across both bindings.

Source

fn is_set(&self) -> bool

Whether the input is present in the process environment.

Source

fn is_set_in(&self, env: &impl EnvSource) -> bool

Whether the input is present in env.

Source

fn raw(&self) -> Option<String>

The raw, unparsed value from the process environment, if set.

Source

fn raw_in(&self, env: &impl EnvSource) -> Option<String>

The raw, unparsed value from env, if set.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, C> InputResolveExt<T> for Input<T, C>
where T: 'static + FromRaw,