| 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. |
| 4 | pub trait ChannelExtrust-analyzer cargo irc-proto 1.1.0 chan/ChannelExt# { |
| 5 | /// Returns true if the specified name is a channel name. |
| 6 | fn is_channel_namerust-analyzer cargo irc-proto 1.1.0 chan/ChannelExt#is_channel_name().(&self) -> bool; |
| 7 | } |
| 8 | |
| 9 | impl<'a> ChannelExtrust-analyzer cargo irc-proto 1.1.0 chan/ChannelExt# for &'a str { |
| 10 | fn is_channel_namerust-analyzer cargo irc-proto 1.1.0 chan/impl#[`&'a str`][ChannelExt]is_channel_name().(&self) -> bool { |
| 11 | self.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('#') |
| 12 | || self.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('&') |
| 13 | || self.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('+') |
| 14 | || self.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('!') |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | impl ChannelExtrust-analyzer cargo irc-proto 1.1.0 chan/ChannelExt# for Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 19 | fn is_channel_namerust-analyzer cargo irc-proto 1.1.0 chan/impl#[String][ChannelExt]is_channel_name().(&self) -> bool { |
| 20 | (&self[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().).is_channel_namerust-analyzer cargo irc-proto 1.1.0 chan/impl#[`&'a str`][ChannelExt]is_channel_name().() |
| 21 | } |
| 22 | } |