modes: new crate representing the API for different round types
Single is our first one - trivial really. Only thing we need to check is that the single isn't made up of a joker.
This commit is contained in:
17
src/modes/single.rs
Normal file
17
src/modes/single.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::card::Card;
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Copy, Clone)]
|
||||
pub struct Single(Card);
|
||||
|
||||
impl Single {
|
||||
fn new(c: Card) -> Option<Single> {
|
||||
(!c.is_joker()).then_some(Single(c))
|
||||
}
|
||||
}
|
||||
|
||||
use std::fmt::{Display, Formatter, Result};
|
||||
impl Display for Single {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
||||
write!(f, "Single({})", self.0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user