pub struct ParamSet {
pub specs: Vec<ParamSpec>,
pub values: BTreeMap<String, Value>,
}Expand description
A set of parameter descriptions and their current values.
Fields§
§specs: Vec<ParamSpec>Descriptions in declaration order.
values: BTreeMap<String, Value>Current values; missing entries use the default.
Implementations§
Source§impl ParamSet
impl ParamSet
Sourcepub fn with_param(self, spec: ParamSpec) -> Result<Self, Error>
pub fn with_param(self, spec: ParamSpec) -> Result<Self, Error>
Adds a specification and its default value.
§Errors
Returns Error::InvalidInput for a duplicate name or a default that
violates the specification.
Sourcepub fn set(&mut self, name: &str, value: Value) -> Result<(), Error>
pub fn set(&mut self, name: &str, value: Value) -> Result<(), Error>
Sets a value after validation.
§Errors
Returns Error::InvalidInput for an unknown parameter or an invalid
value.
Sourcepub fn check_required(&self) -> Result<(), Error>
pub fn check_required(&self) -> Result<(), Error>
Checks that every required parameter has a value.
§Errors
Returns Error::InvalidInput naming the missing parameter.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ParamSet
impl<'de> Deserialize<'de> for ParamSet
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ParamSet
Auto Trait Implementations§
impl Forget for ParamSet
impl Freeze for ParamSet
impl Move for ParamSet
impl RefUnwindSafe for ParamSet
impl Send for ParamSet
impl Sync for ParamSet
impl Unpin for ParamSet
impl UnsafeUnpin for ParamSet
impl UnwindSafe for ParamSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more