| 1 | //! A module providing an enum for a message prefix. |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 4 | |
| 5 | /// The Prefix indicates "the true origin of the message", according to the server. |
| 6 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 7 | pub enum Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix# { |
| 8 | /// servername, e.g. collins.mozilla.org |
| 9 | ServerNamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#ServerName#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 10 | /// nickname [ ["!" username] "@" hostname ] |
| 11 | /// i.e. Nickname(nickname, username, hostname) |
| 12 | /// Any of the strings may be "" |
| 13 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 14 | } |
| 15 | |
| 16 | impl Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix# { |
| 17 | /// Creates a prefix by parsing a string. |
| 18 | /// |
| 19 | /// # Example |
| 20 | /// ``` |
| 21 | /// # extern crate irc_proto; |
| 22 | /// # use irc_proto::Prefix; |
| 23 | /// # fn main() { |
| 24 | /// Prefix::new_from_str("nickname!username@hostname"); |
| 25 | /// Prefix::new_from_str("example.com"); |
| 26 | /// # } |
| 27 | /// ``` |
| 28 | pub fn new_from_strrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix]new_from_str().(s: &str) -> Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix# { |
| 29 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 30 | enum Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active# { |
| 31 | Namerust-analyzer cargo irc-proto 1.1.0 prefix/Active#Name#, |
| 32 | Userrust-analyzer cargo irc-proto 1.1.0 prefix/Active#User#, |
| 33 | Hostrust-analyzer cargo irc-proto 1.1.0 prefix/Active#Host#, |
| 34 | } |
| 35 | |
| 36 | let mut name = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 37 | let mut user = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 38 | let mut host = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 39 | let mut active = Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Namerust-analyzer cargo irc-proto 1.1.0 prefix/Active#Name#; |
| 40 | let mut is_server = false; |
| 41 | |
| 42 | for c in s.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().() { |
| 43 | if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'.' && active rust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Active][`PartialEq<Self>`]eq().==rust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Active][`PartialEq<Self>`]eq(). rust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Active][`PartialEq<Self>`]eq().Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Namerust-analyzer cargo irc-proto 1.1.0 prefix/Active#Name# { |
| 44 | // We won't return Nickname("nick", "", "") but if @ or ! are |
| 45 | // encountered, then we set this back to false |
| 46 | is_server = true; |
| 47 | } |
| 48 | |
| 49 | match c { |
| 50 | '!' if active rust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Active][`PartialEq<Self>`]eq().==rust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Active][`PartialEq<Self>`]eq(). rust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Active][`PartialEq<Self>`]eq().Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Namerust-analyzer cargo irc-proto 1.1.0 prefix/Active#Name# => { |
| 51 | is_server = false; |
| 52 | active = Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Userrust-analyzer cargo irc-proto 1.1.0 prefix/Active#User#; |
| 53 | } |
| 54 | |
| 55 | '@' if active rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Hostrust-analyzer cargo irc-proto 1.1.0 prefix/Active#Host# => { |
| 56 | is_server = false; |
| 57 | active = Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Hostrust-analyzer cargo irc-proto 1.1.0 prefix/Active#Host#; |
| 58 | } |
| 59 | |
| 60 | _ => { |
| 61 | // Push onto the active buffer |
| 62 | match active { |
| 63 | Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Namerust-analyzer cargo irc-proto 1.1.0 prefix/Active#Name# => &mut name, |
| 64 | Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Userrust-analyzer cargo irc-proto 1.1.0 prefix/Active#User# => &mut user, |
| 65 | Activerust-analyzer cargo irc-proto 1.1.0 prefix/Active#::Hostrust-analyzer cargo irc-proto 1.1.0 prefix/Active#Host# => &mut host, |
| 66 | } |
| 67 | .pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c) |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | if is_server { |
| 73 | Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::ServerNamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#ServerName#(name) |
| 74 | } else { |
| 75 | Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#(name, user, host) |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /// This implementation never returns an error and is isomorphic with `Display`. |
| 81 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix# { |
| 82 | type Errrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix][FromStr]Err# = (); |
| 83 | |
| 84 | fn from_strrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix][FromStr], Selfrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 85 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::new_from_strrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix]new_from_str().(s)) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /// This is isomorphic with `FromStr` |
| 90 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix# { |
| 91 | fn fmtrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 92 | match self { |
| 93 | Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::ServerNamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#ServerName#(name) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", name), |
| 94 | Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#(name, user, host) => match (&name[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., &user[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., &host[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) { |
| 95 | ("", "", "") => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, ""), |
| 96 | (name, "", "") => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", name), |
| 97 | (name, user, "") => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}!{}", name, user), |
| 98 | (name, "", host) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}@{}", name, host), |
| 99 | (name, user, host) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}!{}@{}", name, user, host), |
| 100 | }, |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | impl<'a> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'a str> for Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix# { |
| 106 | fn fromrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix][`From<&'a str>`]from().(s: &str) -> Selfrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix][`From<&'a str>`] { |
| 107 | Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::new_from_strrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix]new_from_str().(s) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | #[cfg(test)] |
| 112 | mod testrust-analyzer cargo irc-proto 1.1.0 prefix/test/ { |
| 113 | use superrust-analyzer cargo irc-proto 1.1.0 prefix/::Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::{selfrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#, Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#, ServerNamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#ServerName#}; |
| 114 | |
| 115 | // Checks that str -> parsed -> Display doesn't lose data |
| 116 | fn test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().(s: &str) -> Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix# { |
| 117 | let prefix = Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#::new_from_strrust-analyzer cargo irc-proto 1.1.0 prefix/impl#[Prefix]new_from_str().(s); |
| 118 | let s2 = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", prefix); |
| 119 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(s, &s2); |
| 120 | prefix |
| 121 | } |
| 122 | |
| 123 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 124 | fn printrust-analyzer cargo irc-proto 1.1.0 prefix/test/print().() { |
| 125 | let s = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("nick".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 126 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s, "nick"); |
| 127 | let s = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("nick".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "user".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 128 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s, "nick!user"); |
| 129 | let s = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("nick".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "user".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "host".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 130 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s, "nick!user@host"); |
| 131 | } |
| 132 | |
| 133 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 134 | fn parse_wordrust-analyzer cargo irc-proto 1.1.0 prefix/test/parse_word().() { |
| 135 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 136 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("only_nick"), |
| 137 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("only_nick".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()) |
| 138 | ) |
| 139 | } |
| 140 | |
| 141 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 142 | fn parse_hostrust-analyzer cargo irc-proto 1.1.0 prefix/test/parse_host().() { |
| 143 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("host.tld"), ServerNamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#ServerName#("host.tld".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 144 | } |
| 145 | |
| 146 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 147 | fn parse_nick_userrust-analyzer cargo irc-proto 1.1.0 prefix/test/parse_nick_user().() { |
| 148 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 149 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("test!nick"), |
| 150 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("test".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "nick".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()) |
| 151 | ) |
| 152 | } |
| 153 | |
| 154 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 155 | fn parse_nick_user_hostrust-analyzer cargo irc-proto 1.1.0 prefix/test/parse_nick_user_host().() { |
| 156 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 157 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("test!nick@host"), |
| 158 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("test".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "nick".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "host".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 159 | ) |
| 160 | } |
| 161 | |
| 162 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 163 | fn parse_dot_and_symbolsrust-analyzer cargo irc-proto 1.1.0 prefix/test/parse_dot_and_symbols().() { |
| 164 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 165 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("test.net@something"), |
| 166 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("test.net".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "something".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 167 | ) |
| 168 | } |
| 169 | |
| 170 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 171 | fn parse_danger_casesrust-analyzer cargo irc-proto 1.1.0 prefix/test/parse_danger_cases().() { |
| 172 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 173 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("name@name!user"), |
| 174 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("name".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "name!user".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 175 | ); |
| 176 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 177 | // can't reverse the parse |
| 178 | "name!@".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 179 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("name".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 180 | ); |
| 181 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 182 | // can't reverse the parse |
| 183 | "name!@hostname".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 184 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("name".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "hostname".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 185 | ); |
| 186 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 187 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("name!.user"), |
| 188 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("name".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), ".user".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 189 | ); |
| 190 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 191 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("name!user.user"), |
| 192 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("name".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "user.user".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 193 | ); |
| 194 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 195 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("[email protected]"), |
| 196 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("name".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "user".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "host.host".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 197 | ); |
| 198 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 199 | test_parserust-analyzer cargo irc-proto 1.1.0 prefix/test/test_parse().("!user"), |
| 200 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "user".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 201 | ); |
| 202 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 203 | "[email protected]".parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<Prefixrust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#>().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 204 | Nicknamerust-analyzer cargo irc-proto 1.1.0 prefix/Prefix#Nickname#("".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "host.host".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 205 | ); |
| 206 | } |
| 207 | } |