Skip to main content

HasLabels

Trait HasLabels 

Source
pub trait HasLabels {
    // Required method
    fn labels(&self) -> &Labels;

    // Provided methods
    fn label_to_index(&self, x: &str) -> Result<usize> { ... }
    fn index_to_label(&self, x: usize) -> Result<&str> { ... }
    fn index_to(&self, x: usize, other: &Labels) -> Result<usize> { ... }
    fn indices_to(&self, x: &Set<usize>, other: &Labels) -> Result<Set<usize>> { ... }
    fn index_from(&self, x: usize, other: &Labels) -> Result<usize> { ... }
    fn indices_from(&self, x: &Set<usize>, other: &Labels) -> Result<Set<usize>> { ... }
}
Expand description

A trait for models with labelled variables.

Required Methods§

Source

fn labels(&self) -> &Labels

Returns the labels of the variables.

§Returns

A reference to the labels.

Provided Methods§

Source

fn label_to_index(&self, x: &str) -> Result<usize>

Return the variable index for a given label.

§Arguments
  • x - The label of the variable.
§Errors
  • If the label is not found.
§Returns

The index of the variable.

Source

fn index_to_label(&self, x: usize) -> Result<&str>

Return the label for a given variable index.

§Arguments
  • x - The index of the variable.
§Errors
  • If the index is out of bounds.
§Returns

The label of the variable.

Source

fn index_to(&self, x: usize, other: &Labels) -> Result<usize>

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.
§Errors
  • If the index is out of bounds.
  • If the label does not exist in the other model.
§Returns

The index in the other model.

Source

fn indices_to(&self, x: &Set<usize>, other: &Labels) -> Result<Set<usize>>

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.
§Errors
  • 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.

Source

fn index_from(&self, x: usize, other: &Labels) -> Result<usize>

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.
§Errors
  • If the index is out of bounds.
  • If the label does not exist in this model.
§Returns

The index in this model.

Source

fn indices_from(&self, x: &Set<usize>, other: &Labels) -> Result<Set<usize>>

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.
§Errors
  • If any index is out of bounds.
  • If any label does not exist in this model.
§Returns

The set of indices in this model.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<L, R> HasLabels for Either<L, R>
where L: HasLabels, R: HasLabels,

Source§

fn labels(&self) -> &Labels

Implementors§

Source§

impl HasLabels for CatBN

Source§

impl HasLabels for CatCIM

Source§

impl HasLabels for CatCPD

Source§

impl HasLabels for CatCTBN

Source§

impl HasLabels for CatEv

Source§

impl HasLabels for CatIncTable

Source§

impl HasLabels for CatPhi

Source§

impl HasLabels for CatTable

Source§

impl HasLabels for CatTrj

Source§

impl HasLabels for CatTrjEv

Source§

impl HasLabels for CatTrjs

Source§

impl HasLabels for CatTrjsEv

Source§

impl HasLabels for CatWtdTable

Source§

impl HasLabels for CatWtdTrj

Source§

impl HasLabels for CatWtdTrjs

Source§

impl HasLabels for DiGraph

Source§

impl HasLabels for GaussBN

Source§

impl HasLabels for GaussCPD

Source§

impl HasLabels for GaussEv

Source§

impl HasLabels for GaussIncTable

Source§

impl HasLabels for GaussPhi

Source§

impl HasLabels for GaussTable

Source§

impl HasLabels for GaussWtdTable

Source§

impl HasLabels for MissingMechanism

Source§

impl HasLabels for MissingTable

Source§

impl HasLabels for MixedBN

Source§

impl HasLabels for MixedCPD

Source§

impl HasLabels for MixedPhi

Source§

impl HasLabels for UnGraph

Source§

impl<'a, E, P> HasLabels for AIC<'a, E, P>
where E: HasLabels,

Source§

impl<'a, E, P> HasLabels for AICC<'a, E, P>
where E: HasLabels,

Source§

impl<'a, E, P> HasLabels for BIC<'a, E, P>
where E: HasLabels,

Source§

impl<'a, E, P> HasLabels for BICC<'a, E, P>
where E: HasLabels,

Source§

impl<'a, E, P> HasLabels for HQC<'a, E, P>
where E: HasLabels,

Source§

impl<'a, E, P> HasLabels for LL<'a, E, P>
where E: HasLabels,

Source§

impl<'a, E> HasLabels for ChiSquaredTest<'a, E>
where E: HasLabels,

Source§

impl<C, K, V> HasLabels for Cache<'_, C, K, V>
where C: HasLabels,

Source§

impl<D, T> HasLabels for BE<'_, D, T>
where D: HasLabels,

Source§

impl<D> HasLabels for MLE<'_, D>
where D: HasLabels,

Source§

impl<D> HasLabels for RAWE<D>
where D: HasLabels,

Source§

impl<D> HasLabels for SSE<'_, D>
where D: HasLabels,

Source§

impl<E> HasLabels for FTest<'_, E>
where E: HasLabels,