forked from lavina/lavina
32 lines
681 B
Rust
32 lines
681 B
Rust
use super::*;
|
|
use std::fmt;
|
|
use crate::core::player::PlayerId;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub enum Prefix {
|
|
empty,
|
|
}
|
|
|
|
impl fmt::Display for Prefix {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
match self {
|
|
Prefix::empty => write!(f, ""),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct PrefixedNick {
|
|
pub prefix: Prefix,
|
|
pub nick: Str,
|
|
}
|
|
|
|
impl PrefixedNick {
|
|
pub fn fromStr(nick: Str) -> PrefixedNick {
|
|
PrefixedNick { prefix: Prefix::empty, nick }
|
|
}
|
|
|
|
pub fn fromPlayerId(id: PlayerId) -> PrefixedNick {
|
|
PrefixedNick { prefix: Prefix::empty, nick: id.into_inner() }
|
|
}
|
|
} |