rair_env

Struct Environment

Source
pub struct Environment<T> { /* private fields */ }

Implementations§

Source§

impl<T> Environment<T>

Source

pub fn new() -> Self

Source

pub fn add_str_with_cb( &mut self, key: &str, val: &str, help: &str, data: &mut T, cb: StrFn<T>, ) -> Result<(), EnvErr>

Source

pub fn add_str( &mut self, key: &str, val: &str, help: &str, ) -> Result<(), EnvErr>

Source

pub fn get_str(&self, key: &str) -> Result<&str, EnvErr>

Source

pub fn set_str( &mut self, key: &str, value: &str, data: &mut T, ) -> Result<(), EnvErr>

Source

pub fn is_str(&self, key: &str) -> bool

Source

pub fn add_u64_with_cb( &mut self, key: &str, val: u64, help: &str, data: &mut T, cb: U64Fn<T>, ) -> Result<(), EnvErr>

Source

pub fn add_u64(&mut self, key: &str, val: u64, help: &str) -> Result<(), EnvErr>

Source

pub fn get_u64(&self, key: &str) -> Result<u64, EnvErr>

Source

pub fn set_u64( &mut self, key: &str, value: u64, data: &mut T, ) -> Result<(), EnvErr>

Source

pub fn is_u64(&self, key: &str) -> bool

Source

pub fn add_i64_with_cb( &mut self, key: &str, val: i64, help: &str, data: &mut T, cb: I64Fn<T>, ) -> Result<(), EnvErr>

Source

pub fn add_i64(&mut self, key: &str, val: i64, help: &str) -> Result<(), EnvErr>

Source

pub fn get_i64(&self, key: &str) -> Result<i64, EnvErr>

Source

pub fn set_i64( &mut self, key: &str, value: i64, data: &mut T, ) -> Result<(), EnvErr>

Source

pub fn is_i64(&self, key: &str) -> bool

Source

pub fn add_bool_with_cb( &mut self, key: &str, val: bool, help: &str, data: &mut T, cb: BoolFn<T>, ) -> Result<(), EnvErr>

Source

pub fn add_bool( &mut self, key: &str, val: bool, help: &str, ) -> Result<(), EnvErr>

Source

pub fn get_bool(&self, key: &str) -> Result<bool, EnvErr>

Source

pub fn set_bool( &mut self, key: &str, value: bool, data: &mut T, ) -> Result<(), EnvErr>

Source

pub fn is_bool(&self, key: &str) -> bool

Source

pub fn add_color_with_cb( &mut self, key: &str, val: (u8, u8, u8), help: &str, data: &mut T, cb: ColorFn<T>, ) -> Result<(), EnvErr>

Source

pub fn add_color( &mut self, key: &str, val: (u8, u8, u8), help: &str, ) -> Result<(), EnvErr>

Source

pub fn get_color(&self, key: &str) -> Result<(u8, u8, u8), EnvErr>

Source

pub fn set_color( &mut self, key: &str, value: (u8, u8, u8), data: &mut T, ) -> Result<(), EnvErr>

Source

pub fn is_color(&self, key: &str) -> bool

Source

pub fn reset(&mut self, key: &str, data: &mut T) -> Result<(), EnvErr>

Source

pub fn get(&self, key: &str) -> Option<EnvData<'_>>

Source

pub fn get_help(&self, key: &str) -> Option<&str>

Source

pub fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (&str, EnvData<'_>)> + 'a>

Trait Implementations§

Source§

impl<T: Default> Default for Environment<T>

Source§

fn default() -> Environment<T>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Environment<T>

§

impl<T> RefUnwindSafe for Environment<T>

§

impl<T> Send for Environment<T>

§

impl<T> Sync for Environment<T>

§

impl<T> Unpin for Environment<T>

§

impl<T> UnwindSafe for Environment<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.