cock_tier/modules/
traits.rs

1/// [Score] is a trait for objects that can be scored.
2/// The score function returns a [u32] representing the score of the object.
3pub trait Score {
4    fn score(&self) -> u32;
5}
6
7/// [GetVariants] is a trait for objects that have a set of variants.
8/// The [GetVariants::get_variants] function returns a vector of strings, each representing a variant of the object.
9pub trait GetVariants {
10    /// Function to get the variants of the object.
11    fn get_variants() -> Vec<String>;
12}
13
14/// [FromString] is a trait for objects that can be constructed from a string.
15/// The [FromString::from_string] function takes a string reference as input and returns an instance of the type implementing this trait based on the string.
16pub trait FromString {
17    /// Function to create an instance of the type implementing this trait from a string.
18    fn from_string(string: &str) -> Self;
19}