mirror of
https://github.com/ricoriedel/wipe.git
synced 2024-12-23 06:36:42 +00:00
Rename trait
This commit is contained in:
parent
3f8e27d313
commit
b6a2ae85f4
@ -1,7 +1,7 @@
|
||||
use rand::prelude::IteratorRandom;
|
||||
use rand::Rng;
|
||||
|
||||
pub trait Options {
|
||||
pub trait Collection {
|
||||
fn all() -> Vec<Self> where Self: Sized;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ impl<TRng: Rng> Chooser<TRng> {
|
||||
Self { rng }
|
||||
}
|
||||
|
||||
pub fn choose<TValue: Options>(&mut self, selection: Vec<TValue>) -> TValue {
|
||||
pub fn choose<TValue: Collection>(&mut self, selection: Vec<TValue>) -> TValue {
|
||||
let options = if selection.is_empty() {
|
||||
TValue::all()
|
||||
} else {
|
||||
@ -27,7 +27,7 @@ impl<TRng: Rng> Chooser<TRng> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use rand::rngs::mock::StepRng;
|
||||
use crate::{Chooser, Options};
|
||||
use crate::{Chooser, Collection};
|
||||
|
||||
enum MockOptions {
|
||||
First,
|
||||
@ -35,7 +35,7 @@ mod test {
|
||||
Third
|
||||
}
|
||||
|
||||
impl Options for MockOptions {
|
||||
impl Collection for MockOptions {
|
||||
fn all() -> Vec<Self> where Self: Sized {
|
||||
use MockOptions::*;
|
||||
|
||||
|
@ -9,7 +9,7 @@ use crate::animation::circle::CircleAnimation;
|
||||
use crate::animation::rhombus::RhombusAnimation;
|
||||
use crate::animation::rotation::RotationAnimation;
|
||||
use crate::char::SimpleCharSampler;
|
||||
use crate::choose::{Chooser, Options};
|
||||
use crate::choose::{Chooser, Collection};
|
||||
use crate::color::{ColorSampler, SimpleColorSampler};
|
||||
use crate::fill::circle::CircleFillMode;
|
||||
use crate::fill::FillMode;
|
||||
@ -41,7 +41,7 @@ macro_rules! options {
|
||||
enum $name {
|
||||
$($opt,)*
|
||||
}
|
||||
impl Options for $name {
|
||||
impl Collection for $name {
|
||||
fn all() -> Vec<Self> {
|
||||
vec![$($name::$opt,)*]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user