1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use super::*;
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Join<'t> {
pub name: Cow<'t, str>,
pub channel: Cow<'t, str>,
}
impl<'a: 't, 't> Parse<&'a Message<'t>> for Join<'t> {
fn parse(msg: &'a Message<'t>) -> Result<Self, InvalidMessage> {
msg.expect_command("JOIN")?;
Ok(Self {
name: msg.expect_nick()?,
channel: msg.expect_arg(0)?,
})
}
}
impl<'t> AsOwned for Join<'t> {
type Owned = Join<'static>;
fn as_owned(&self) -> Self::Owned {
Join {
name: self.name.as_owned(),
channel: self.channel.as_owned(),
}
}
}