pub struct EnvParser { /* private fields */ }Expand description
Type-safe environment variable parser.
Collects errors during parsing so all issues can be reported at once.
Implementations§
Source§impl EnvParser
impl EnvParser
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if any errors occurred.
Sourcepub fn take_errors(&mut self) -> Vec<EnvError>
pub fn take_errors(&mut self) -> Vec<EnvError>
Take ownership of errors.
Sourcepub fn get_string(&mut self, name: &str, default: &str) -> Sourced<String>
pub fn get_string(&mut self, name: &str, default: &str) -> Sourced<String>
Get a string value with default.
Sourcepub fn get_bool(&mut self, name: &str, default: bool) -> Sourced<bool>
pub fn get_bool(&mut self, name: &str, default: bool) -> Sourced<bool>
Get a boolean value with default.
Accepts: 1, true, yes, on (for true) 0, false, no, off, “” (for false)
Sourcepub fn get_u32_range(
&mut self,
name: &str,
default: u32,
min: u32,
max: u32,
) -> Sourced<u32>
pub fn get_u32_range( &mut self, name: &str, default: u32, min: u32, max: u32, ) -> Sourced<u32>
Get a u32 value with default and range validation.
Sourcepub fn get_u64_range(
&mut self,
name: &str,
default: u64,
min: u64,
max: u64,
) -> Sourced<u64>
pub fn get_u64_range( &mut self, name: &str, default: u64, min: u64, max: u64, ) -> Sourced<u64>
Get a u64 value with default and range validation.
Sourcepub fn get_i32_range(
&mut self,
name: &str,
default: i32,
min: i32,
max: i32,
) -> Sourced<i32>
pub fn get_i32_range( &mut self, name: &str, default: i32, min: i32, max: i32, ) -> Sourced<i32>
Get an i32 value with default and range validation.
Sourcepub fn get_f64_range(
&mut self,
name: &str,
default: f64,
min: f64,
max: f64,
) -> Sourced<f64>
pub fn get_f64_range( &mut self, name: &str, default: f64, min: f64, max: f64, ) -> Sourced<f64>
Get a f64 value with default and range validation.
Sourcepub fn get_path(
&mut self,
name: &str,
default: &str,
must_exist: bool,
) -> Sourced<PathBuf>
pub fn get_path( &mut self, name: &str, default: &str, must_exist: bool, ) -> Sourced<PathBuf>
Get a path value with ~ expansion.
If must_exist is true, records an error if the path doesn’t exist.
Sourcepub fn get_log_level(&mut self, name: &str, default: &str) -> Sourced<String>
pub fn get_log_level(&mut self, name: &str, default: &str) -> Sourced<String>
Get a log level value with validation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EnvParser
impl RefUnwindSafe for EnvParser
impl Send for EnvParser
impl Sync for EnvParser
impl Unpin for EnvParser
impl UnsafeUnpin for EnvParser
impl UnwindSafe for EnvParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more