[][src]Trait yasec::Yasec

pub trait Yasec {
    fn init() -> Result<Self, Error>
    where
        Self: Sized
, { ... }
fn with_prefix(prefix: impl AsRef<str>) -> Result<Self, Error>
    where
        Self: Sized
, { ... }
fn with_context(context: Context<Self>) -> Result<Self, Error>
    where
        Self: Sized
, { ... }
fn parse(_val: &str) -> Result<Self, Box<dyn StdError>>
    where
        Self: Sized
, { ... } }

Indicates that structure can be initialize from environment variables.

Provided methods

fn init() -> Result<Self, Error> where
    Self: Sized

Creates empty context and calls with_context.

fn with_prefix(prefix: impl AsRef<str>) -> Result<Self, Error> where
    Self: Sized

fn with_context(context: Context<Self>) -> Result<Self, Error> where
    Self: Sized

Initialize structure from environment variable from the passed context. By default calls parse method. It works for a basic type like number or string. The method is redefined for a sctructure with #[derive(Yasec). In that case the method pick every field type and calls the method for the type.

fn parse(_val: &str) -> Result<Self, Box<dyn StdError>> where
    Self: Sized

Parses an environment variable value. It sould be implemented if an object is leaf of a configuration structure.

Loading content...

Implementations on Foreign Types

impl Yasec for char[src]

impl Yasec for u8[src]

impl Yasec for u16[src]

impl Yasec for u32[src]

impl Yasec for u64[src]

impl Yasec for i8[src]

impl Yasec for i16[src]

impl Yasec for i32[src]

impl Yasec for i64[src]

impl Yasec for f32[src]

impl Yasec for f64[src]

impl Yasec for String[src]

impl<T: Yasec> Yasec for Option<T>[src]

Loading content...

Implementors

Loading content...