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