Trait Labelled
Source pub trait Labelled {
// Required method
fn labels(&self) -> &Labels;
// Provided methods
fn label_to_index(&self, x: &str) -> usize { ... }
fn index_to_label(&self, x: usize) -> &str { ... }
fn index_to(&self, x: usize, other: &Labels) -> usize { ... }
fn indices_to(&self, x: &Set<usize>, other: &Labels) -> Set<usize> { ... }
fn index_from(&self, x: usize, other: &Labels) -> usize { ... }
fn indices_from(&self, x: &Set<usize>, other: &Labels) -> Set<usize> { ... }
}
Expand description
A trait for models with labelled variables.
Returns the labels of the variables.
§Returns
A reference to the labels.
Return the variable index for a given label.
§Arguments
x - The label of the variable.
§Panics
- If the label is not in the map.
§Returns
The index of the variable.
Return the label for a given variable index.
§Arguments
x - The index of the variable.
§Panics
- If the index is out of bounds.
§Returns
The label of the variable.
Maps an index from this model to another model with the same label.
§Arguments
x - The index in this model.
other - The labels of the other model.
§Panics
- If the index is out of bounds.
- If the label does not exist in the other model.
§Returns
The index in the other model.
Maps a set of indices from this model to another model with the same labels.
§Arguments
x - The set of indices in this model.
other - The labels of the other model.
§Panics
- If any index is out of bounds.
- If any label does not exist in the other model.
§Returns
The set of indices in the other model.
Maps an index from another model to this model with the same label.
§Arguments
x - The index in the other model.
other - The labels of the other model.
§Panics
- If the index is out of bounds.
- If the label does not exist in this model.
§Returns
The index in this model.
Maps a set of indices from another model to this model with the same labels.
§Arguments
x - The set of indices in the other model.
other - The labels of the other model.
§Panics
- If any index is out of bounds.
- If any label does not exist in this model.
§Returns
The set of indices in this model.