pub fn from_yaml<T: DeserializeOwned>(yaml: &str) -> Result<T>Expand description
One config section from YAML, the way the config file reads it: for the
sections an embedder hands to a builder method, such as
ProxyServer::with_rate_limits.
§Errors
YAML that is not that section.
§Examples
use structured_proxy::config::{self, ShieldConfig};
let shield: ShieldConfig = config::from_yaml(
"enabled: true\nprofiles:\n anon: { rate: \"60/min\" }\nrules:\n - pattern: \"/**\"\n key: { type: ip }\n profile: anon\n",
)
.unwrap();
assert!(shield.enabled);