irc_async/proto/
chan.rs

1//! An extension trait that provides the ability to check if a string is a channel name.
2
3/// An extension trait giving strings a function to check if they are a channel.
4pub trait ChannelExt {
5    /// Returns true if the specified name is a channel name.
6    fn is_channel_name(&self) -> bool;
7}
8
9impl<'a> ChannelExt for &'a str {
10    fn is_channel_name(&self) -> bool {
11        self.starts_with('#')
12            || self.starts_with('&')
13            || self.starts_with('+')
14            || self.starts_with('!')
15    }
16}
17
18impl ChannelExt for String {
19    fn is_channel_name(&self) -> bool {
20        (&self[..]).is_channel_name()
21    }
22}