This commit is contained in:
Robin Appelman 2023-11-21 19:04:24 +01:00
commit 7f85e52c71

View file

@ -240,24 +240,24 @@ impl GameMode {
pub struct Transaction { pub struct Transaction {
pub name: String, pub name: String,
pub steam_id: SteamID, pub steam_id: SteamID,
pub action: TranactionAction, pub action: TransactionAction,
pub team: TeamRef, pub team: TeamRef,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))] #[cfg_attr(feature = "serde", derive(serde::Serialize))]
pub enum TranactionAction { pub enum TransactionAction {
Joined, Joined,
Left, Left,
} }
impl FromStr for TranactionAction { impl FromStr for TransactionAction {
type Err = ParseError; type Err = ParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
match s { match s {
"Joined" => Ok(TranactionAction::Joined), "Joined" => Ok(TransactionAction::Joined),
"Left" => Ok(TranactionAction::Left), "Left" => Ok(TransactionAction::Left),
_ => Err(ParseError::InvalidText { _ => Err(ParseError::InvalidText {
role: "transaction action", role: "transaction action",
text: s.to_string(), text: s.to_string(),