pub trait Number<V>{
// Required methods
fn new(numberer: Numberer<V>) -> Self;
fn len(&self) -> usize;
fn number(&self, value: V) -> Option<usize>;
fn value(&self, number: usize) -> Option<V>;
}
Expand description
Number a categorical variable.
Required Methods§
Sourcefn len(&self) -> usize
fn len(&self) -> usize
Get the number of possible values in the categorical variable.
This includes reserved numerical representations that do not correspond to values in the categorial variable.
Sourcefn number(&self, value: V) -> Option<usize>
fn number(&self, value: V) -> Option<usize>
Get the number of a value from a categorical variable.
Mutable implementations of this trait must add the value if it
is unknown and always return Option::Some
.
Sourcefn value(&self, number: usize) -> Option<V>
fn value(&self, number: usize) -> Option<V>
Get the value corresponding of a number.
Returns Option::None
if the number is unknown or a
reserved number.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.