forked from lavina/lavina
PrefixedNick creation raw, not Result
This commit is contained in:
parent
eb123da0e9
commit
1617f428e4
|
@ -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()).unwrap()).collect();
|
let prefixed_members: Vec<PrefixedNick> = room_info.members.iter().map(|member| PrefixedNick::fromPlayerId(member.clone())).collect();
|
||||||
let non_empty_members: NonEmpty<PrefixedNick> = NonEmpty::from_vec(prefixed_members).unwrap_or(nonempty![PrefixedNick::fromStr(user.nickname.clone()).unwrap()]);
|
let non_empty_members: NonEmpty<PrefixedNick> = NonEmpty::from_vec(prefixed_members).unwrap_or(nonempty![PrefixedNick::fromStr(user.nickname.clone())]);
|
||||||
|
|
||||||
ServerMessage {
|
ServerMessage {
|
||||||
tags: vec![],
|
tags: vec![],
|
||||||
|
|
|
@ -20,11 +20,11 @@ pub struct PrefixedNick {
|
||||||
pub nick: Str,
|
pub nick: Str,
|
||||||
}
|
}
|
||||||
impl PrefixedNick {
|
impl PrefixedNick {
|
||||||
pub fn fromStr(nick: Str) -> Result<PrefixedNick> {
|
pub fn fromStr(nick: Str) -> PrefixedNick {
|
||||||
Ok(PrefixedNick { prefix: Prefix::empty, nick } )
|
PrefixedNick { prefix: Prefix::empty, nick }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fromPlayerId(id: PlayerId) -> Result<PrefixedNick> {
|
pub fn fromPlayerId(id: PlayerId) -> PrefixedNick {
|
||||||
Ok(PrefixedNick { prefix: Prefix::empty, nick: id.into_inner() } )
|
PrefixedNick { prefix: Prefix::empty, nick: id.into_inner() }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue