Trait io_providers::env::Provider
[−]
[src]
pub trait Provider { fn args(&self) -> Vec<String>; fn current_dir(&self) -> Result<PathBuf>; fn set_current_dir<P: AsRef<Path>>(&mut self, path: P) -> Result<()>; }
Provides access to environment data, such as working directory and environment variables.
This trait acts more-or-less as a drop-in replacement for std::env
functions. The only
difference is that env::Provider::args()
returns Vec<String>
, and not an iterator like
std::env::args
does.
Note that, since this trait has generic methods, it is not object safe and thus can't be used as a trait object.
Required Methods
fn args(&self) -> Vec<String>
Returns the arguments which this program was started with (normally passed via the command line).
See std::env::args
for more information.
fn current_dir(&self) -> Result<PathBuf>
Returns the current working directory as a PathBuf
.
See std::env::current_dir
for more information.
fn set_current_dir<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Changes the current working directory to the specified path, returning whether the change was completed successfully or not.
See std::env::set_current_dir
for more information.