pub trait Class {
const CLASSES: Option<u32>;
// Required methods
fn to_class(&self) -> u32;
fn from_class(class: u32) -> Self;
}
Expand description
A class that a Classifier
can predict. You can derive this trait for any enum with only unit values.
§Example
#[derive(Debug, Clone, Copy, Class)]
enum MyClass {
Person,
Thing,
}
Required Associated Constants§
Required Methods§
Sourcefn from_class(class: u32) -> Self
fn from_class(class: u32) -> Self
Convert a class index to a class.
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.