pub struct TaskParameters { /* private fields */ }Expand description
One immutable dict-like fixed-plus-sweep parameter selection.
This type owns no JSON values. Cloning it increments one shared reference
count and copies one u64 task ordinal.
Implementations§
Source§impl TaskParameters
impl TaskParameters
Sourcepub fn task_ordinal(&self) -> u64
pub fn task_ordinal(&self) -> u64
Returns this task’s zero-based deterministic ordinal.
Sourcepub fn value(&self, key: &str) -> Option<&Value>
pub fn value(&self, key: &str) -> Option<&Value>
Borrows one fixed or selected sweep value by exact or dotted-nested JSON key.
Missing keys return None. No value is cloned, decoded, or allocated.
Sourcepub fn require_value(&self, key: &str) -> Result<&Value, ConfigurationError>
pub fn require_value(&self, key: &str) -> Result<&Value, ConfigurationError>
Borrows one required value or reports its task and exact missing key.
Sourcepub fn decode_value<T>(&self, key: &str) -> Result<T, ConfigurationError>where
T: DeserializeOwned,
pub fn decode_value<T>(&self, key: &str) -> Result<T, ConfigurationError>where
T: DeserializeOwned,
Decodes one required JSON value into the caller’s concrete Rust type.
Deserialization reads directly from the borrowed serde_json::Value;
this method does not first clone the generic JSON tree. The returned
concrete value is owned and may allocate according to T.
Sourcepub fn decode_values<Values, Keys>(
&self,
keys: Keys,
) -> Result<Values, ConfigurationError>where
Keys: ParameterKeyTuple<Values>,
pub fn decode_values<Values, Keys>(
&self,
keys: Keys,
) -> Result<Values, ConfigurationError>where
Keys: ParameterKeyTuple<Values>,
Decodes several required parameters into a heterogeneous tuple.
Supported key tuples have arities two through twelve. Every element
follows Self::decode_value, so a failure retains the exact task
ordinal and parameter key without constructing a merged JSON object.
Sourcepub fn contains(&self, key: &str) -> bool
pub fn contains(&self, key: &str) -> bool
Reports whether this resolved dictionary contains an exact or nested key.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Reports whether the resolved task contains no parameter entries.
Sourcepub fn keys(&self) -> impl Iterator<Item = &str>
pub fn keys(&self) -> impl Iterator<Item = &str>
Iterates exact keys with fixed declarations first and swept declarations second, preserving source declaration order within each group.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &Value)>
pub fn iter(&self) -> impl Iterator<Item = (&str, &Value)>
Iterates resolved key/value references in the same order as
TaskParameters::keys.
Sourcepub fn to_json(&self) -> Result<String, ConfigurationError>
pub fn to_json(&self) -> Result<String, ConfigurationError>
Serializes the resolved fixed-plus-sweep dictionary as compact JSON.
This is derived task data, not either original source document. Keys are
emitted in TaskParameters::keys order and values are serialized by
reference without constructing a merged serde_json::Map.
Trait Implementations§
Source§impl Clone for TaskParameters
impl Clone for TaskParameters
Source§fn clone(&self) -> TaskParameters
fn clone(&self) -> TaskParameters
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more