pub enum DomainError {
InvalidOpponent,
NotPermitted(String),
InvalidDiscards(String),
NotPlayersTurn(Player),
InvalidPlay(Card),
InvalidGo,
}Expand description
Domain-specific errors that represent invalid game actions.
These errors are returned when a player attempts an illegal move according to the rules of the game (e.g. playing out of turn, invalid discard, etc.).
Variants§
InvalidOpponent
The host and guest must be different users.
NotPermitted(String)
The user is not permitted to perform the action, i.e. they are not a player in the game, or they are trying a command in the inccorect phase in the game.
InvalidDiscards(String)
The user is discarding cards they do not own, or too many or too few cards.
NotPlayersTurn(Player)
The user is making a Play or Go when it is not their turn.
InvalidPlay(Card)
The user is playing card they do not own, or that will make the running total > 31.
InvalidGo
The user is declaring Go even though they have a valid card that
must be played.
Trait Implementations§
Source§impl Debug for DomainError
impl Debug for DomainError
Source§impl Display for DomainError
impl Display for DomainError
Source§impl Error for DomainError
impl Error for DomainError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<DomainError> for ServerError
impl From<DomainError> for ServerError
Source§fn from(source: DomainError) -> Self
fn from(source: DomainError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DomainError
impl PartialEq for DomainError
impl Eq for DomainError
impl StructuralPartialEq for DomainError
Auto Trait Implementations§
impl Freeze for DomainError
impl RefUnwindSafe for DomainError
impl Send for DomainError
impl Sync for DomainError
impl Unpin for DomainError
impl UnwindSafe for DomainError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more