pub struct Assignments(/* private fields */);Expand description
Two-level map: element name → parameter name → value.
Construction via Self::new enforces:
- For every
(element, param) → valueentry,value.provenance().parameter == param. No silently mis-addressed values. - No element appears with an empty inner map.
BTreeMap iteration order is natural, so trial canonical bytes
(and anything else that walks the assignments) see stable
ordering without extra sorting.
Implementations§
Source§impl Assignments
impl Assignments
Sourcepub fn new(
map: BTreeMap<ElementName, BTreeMap<ParameterName, Value>>,
) -> Result<Self, TrialError>
pub fn new( map: BTreeMap<ElementName, BTreeMap<ParameterName, Value>>, ) -> Result<Self, TrialError>
Construct from a pre-built map, validating invariants.
Sourcepub fn get(
&self,
element: &ElementName,
param: &ParameterName,
) -> Option<&Value>
pub fn get( &self, element: &ElementName, param: &ParameterName, ) -> Option<&Value>
Look up one (element, parameter) binding.
Sourcepub fn for_element(
&self,
element: &ElementName,
) -> Option<&BTreeMap<ParameterName, Value>>
pub fn for_element( &self, element: &ElementName, ) -> Option<&BTreeMap<ParameterName, Value>>
Borrow the inner parameter map for an element.
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (&ElementName, &ParameterName, &Value)>
pub fn iter( &self, ) -> impl Iterator<Item = (&ElementName, &ParameterName, &Value)>
Sorted iterator over (element, parameter, value) triples.
Sourcepub fn element_count(&self) -> usize
pub fn element_count(&self) -> usize
Number of distinct elements covered.
Trait Implementations§
Source§impl Clone for Assignments
impl Clone for Assignments
Source§fn clone(&self) -> Assignments
fn clone(&self) -> Assignments
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Assignments
impl Debug for Assignments
Source§impl Default for Assignments
impl Default for Assignments
Source§fn default() -> Assignments
fn default() -> Assignments
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Assignments
impl<'de> Deserialize<'de> for Assignments
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
Source§impl PartialEq for Assignments
impl PartialEq for Assignments
Source§impl Serialize for Assignments
impl Serialize for Assignments
impl StructuralPartialEq for Assignments
Auto Trait Implementations§
impl Freeze for Assignments
impl RefUnwindSafe for Assignments
impl Send for Assignments
impl Sync for Assignments
impl Unpin for Assignments
impl UnsafeUnpin for Assignments
impl UnwindSafe for Assignments
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