forked from lavina/lavina
formatted namings in user.rs
This commit is contained in:
parent
bb2e4eecf8
commit
e5481035a7
|
@ -302,7 +302,7 @@ impl Player {
|
||||||
player_id,
|
player_id,
|
||||||
connections: AnonTable::new(),
|
connections: AnonTable::new(),
|
||||||
my_rooms: HashMap::new(),
|
my_rooms: HashMap::new(),
|
||||||
banned_from: HashSet::from([RoomId::from("empty").unwrap()]),
|
banned_from: HashSet::from([RoomId::from("Empty").unwrap()]),
|
||||||
rx,
|
rx,
|
||||||
handle,
|
handle,
|
||||||
rooms,
|
rooms,
|
||||||
|
|
|
@ -669,8 +669,8 @@ async fn produce_on_join_cmd_messages(
|
||||||
}
|
}
|
||||||
.write_async(writer)
|
.write_async(writer)
|
||||||
.await?;
|
.await?;
|
||||||
let prefixed_members: Vec<PrefixedNick> = room_info.members.iter().map(|member| PrefixedNick::fromPlayerId(member.clone())).collect();
|
let prefixed_members: Vec<PrefixedNick> = room_info.members.iter().map(|member| PrefixedNick::from_player_id(member.clone())).collect();
|
||||||
let non_empty_members: NonEmpty<PrefixedNick> = NonEmpty::from_vec(prefixed_members).unwrap_or(nonempty![PrefixedNick::fromStr(user.nickname.clone())]);
|
let non_empty_members: NonEmpty<PrefixedNick> = NonEmpty::from_vec(prefixed_members).unwrap_or(nonempty![PrefixedNick::from_str(user.nickname.clone())]);
|
||||||
|
|
||||||
ServerMessage {
|
ServerMessage {
|
||||||
tags: vec![],
|
tags: vec![],
|
||||||
|
|
|
@ -4,13 +4,13 @@ use crate::core::player::PlayerId;
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum Prefix {
|
pub enum Prefix {
|
||||||
empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Prefix {
|
impl fmt::Display for Prefix {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Prefix::empty => write!(f, ""),
|
Prefix::Empty => write!(f, ""),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,11 @@ pub struct PrefixedNick {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrefixedNick {
|
impl PrefixedNick {
|
||||||
pub fn fromStr(nick: Str) -> PrefixedNick {
|
pub fn from_str(nick: Str) -> PrefixedNick {
|
||||||
PrefixedNick { prefix: Prefix::empty, nick }
|
PrefixedNick { prefix: Prefix::Empty, nick }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fromPlayerId(id: PlayerId) -> PrefixedNick {
|
pub fn from_player_id(id: PlayerId) -> PrefixedNick {
|
||||||
PrefixedNick { prefix: Prefix::empty, nick: id.into_inner() }
|
PrefixedNick { prefix: Prefix::Empty, nick: id.into_inner() }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,7 @@ impl<V> AnonTable<V> {
|
||||||
pub fn insert(&mut self, value: V) -> Key {
|
pub fn insert(&mut self, value: V) -> Key {
|
||||||
let id = self.next;
|
let id = self.next;
|
||||||
self.next += 1;
|
self.next += 1;
|
||||||
self.inner.insert(id, value); // should be always empty
|
self.inner.insert(id, value); // should be always Empty
|
||||||
Key(id)
|
Key(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue