Skip to main content

Source

Trait Source 

Source
pub trait Source {
    // Required methods
    fn name(&self) -> Cow<'static, str>;
    fn load(&self) -> Result<Option<Value>, ReadError>;
}
Expand description

A source of configuration data.

Implementations return an optional serde_json::Value and provide a short name() for diagnostics.

Required Methods§

Source

fn name(&self) -> Cow<'static, str>

Human-readable source name (used in error messages and docs).

Source

fn load(&self) -> Result<Option<Value>, ReadError>

Load the source and return Ok(Some(value)) if present, Ok(None) if the source is absent, or Err(ReadError) on error.

Implementors§

Source§

impl Source for Value

Allows providing Value as a Source

Source§

impl<Fmt> Source for Env<Fmt>
where Fmt: Format,

Source§

impl<Fmt> Source for File<Fmt>
where Fmt: Format,

Source§

impl<Fmt> Source for RawData<Fmt>
where Fmt: Format,