pub struct Options(pub BTreeMap<String, OptionValue>);Expand description
The options of one port entry: everything under [source], [stream], or
[sinks.<name>] except its type, keyed in sorted order.
Tuple Fields§
§0: BTreeMap<String, OptionValue>Implementations§
Source§impl Options
impl Options
Sourcepub fn empty() -> Self
pub fn empty() -> Self
An empty options map: the entry’s type with no settings, so every
adapter default applies.
Sourcepub fn get(&self, key: &str) -> Option<&OptionValue>
pub fn get(&self, key: &str) -> Option<&OptionValue>
Read one top-level option.
Sourcepub fn insert(&mut self, key: impl Into<String>, value: impl Into<OptionValue>)
pub fn insert(&mut self, key: impl Into<String>, value: impl Into<OptionValue>)
Set one top-level option, replacing an existing value. Used by the composition root to lay a flag or environment override over the file.
Sourcepub fn deserialize_into<T: DeserializeOwned>(self) -> Result<T, OptionsError>
pub fn deserialize_into<T: DeserializeOwned>(self) -> Result<T, OptionsError>
Turn the tree into an adapter’s typed config. The adapter’s struct
decides the strictness (deny_unknown_fields, defaults, required
fields); an error names the offending field.
Sourcepub fn from_serialize<T: Serialize>(value: &T) -> Result<Self, OptionsError>
pub fn from_serialize<T: Serialize>(value: &T) -> Result<Self, OptionsError>
Build the tree from any serializable struct, typically an adapter’s
config: the reverse of deserialize_into,
used to render an adapter’s example and to write a config back out.
Fails if the value is not a map at the top level.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Options
impl<'de> Deserialize<'de> for Options
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Options> for OptionValue
impl From<Options> for OptionValue
Source§impl FromIterator<(String, OptionValue)> for Options
impl FromIterator<(String, OptionValue)> for Options
Source§fn from_iter<I: IntoIterator<Item = (String, OptionValue)>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = (String, OptionValue)>>(iter: I) -> Self
Source§impl JsonSchema for Options
An options map is “any table” to the schema: the adapter’s own schema is
what constrains it, spliced in by the composition root per type.
impl JsonSchema for Options
An options map is “any table” to the schema: the adapter’s own schema is
what constrains it, spliced in by the composition root per type.
Source§fn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more