Rust

source

Module

Where config contents come from.

Contents

use utopia_config::Environment;
Rust
pub struct Environment

The process environment, read once when created: an array of variable names to values.

Rust
use utopia_config::{Environment, Source, Value};

let env = Environment::new();
assert!(matches!(env.contents(), Value::Array(_)));
Also implements Default.
use utopia_config::File;
Rust
pub struct File

A file's contents, read once when created; null when it does not exist or cannot be read.

Rust
use utopia_config::{File, Source, Value};

assert_eq!(File::new("/nonexistent/config.json").contents(), &Value::Null);
use utopia_config::Variable;
Rust
pub struct Variable

Contents given directly: a string to parse, or an array.

Rust
use utopia_config::{Source, Value, Variable};

assert_eq!(Variable::new("KEY=value").contents(), &Value::from("KEY=value"));
use utopia_config::Source;
Rust
pub trait Source

Provides the raw contents a Parser reads: a string for file formats, an array for NoParser, or null when there is nothing to read.