Function config::reader::from_str [] [src]

pub fn from_str(input: &str) -> Result<ConfigConfigError>

Reads a configuration from a string slice. The only possible error that can occur is a syntax error.

Examples

use config::reader::from_str;
use config::error::ConfigErrorKind;

let parsed = from_str("windows=NO;\nlinux=true;\n");
assert!(parsed.is_ok());

This will return a syntax error (missing a semi-colon)

use config::reader::from_str;
use config::error::ConfigErrorKind;

let parsed = from_str("windows=NO\n");
assert!(parsed.is_err());
assert_eq!(parsed.unwrap_err().kind, ConfigErrorKind::ParseError);