[−][src]Struct irc3::proto::message::Message
A full IRC message that can be reprocessed back into its encoded form.
An IRC message can be parsed from a raw message, or it can built using
the [new
] constructor and the builder functions [with_tag
],
[with_tag_vendor
], [with_prefix
] and [with_param
].
Examples
use irc3::Message; fn main() { const MSG: &'static str = ":dan!d@localhost PRIVMSG * :Hey guys, what's up?"; let built_message = Message::new("PRIVMSG") .with_prefix("dan", Some("d"), Some("localhost")) .with_param("*") .with_param("Hey guys, what's up?"); let parsed_message = Message::parse(MSG).unwrap(); assert!(built_message == parsed_message); }
Methods
impl Message
[src]
pub fn new(command: &str) -> Message
[src]
pub fn parse<S: AsRef<str> + ?Sized>(s: &S) -> Result<Message>
[src]
pub fn command(&self) -> &str
[src]
pub fn has_prefix(&self) -> bool
[src]
pub fn origin(&self) -> Option<&str>
[src]
pub fn user(&self) -> Option<&str>
[src]
pub fn host(&self) -> Option<&str>
[src]
pub fn params(&self) -> Iter<String>
[src]
pub fn param(&self, ind: usize) -> Option<&str>
[src]
pub fn tags(&self) -> Iter<Tag>
[src]
pub fn tag(&self, key: &str) -> Option<&Tag>
[src]
pub fn with_prefix(
self,
origin: &str,
user: Option<&str>,
host: Option<&str>
) -> Message
[src]
self,
origin: &str,
user: Option<&str>,
host: Option<&str>
) -> Message
pub fn with_tag(self, key: &str, value: Option<&str>) -> Message
[src]
pub fn with_tag_vendor(
self,
key: &str,
value: Option<&str>,
vendor: Option<&str>
) -> Message
[src]
self,
key: &str,
value: Option<&str>,
vendor: Option<&str>
) -> Message
pub fn with_param(self, param: &str) -> Message
[src]
Trait Implementations
impl Debug for Message
[src]
impl Display for Message
[src]
impl PartialEq<Message> for Message
[src]
impl Sink<Message> for Client
[src]
type Error = MessageTransportError
The type of value produced by the sink when an error occurs.
fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
fn start_send(self: Pin<&mut Self>, msg: Message) -> Result<(), Self::Error>
[src]
fn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
fn poll_close(
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
impl<R> Sink<Message> for MessageTransport<R> where
R: AsyncRead + AsyncWrite + Unpin,
[src]
R: AsyncRead + AsyncWrite + Unpin,
type Error = MessageTransportError
The type of value produced by the sink when an error occurs.
fn poll_ready(
self: Pin<&mut Self>,
_: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]
self: Pin<&mut Self>,
_: &mut Context
) -> Poll<Result<(), Self::Error>>
fn start_send(self: Pin<&mut Self>, item: Message) -> Result<(), Self::Error>
[src]
fn poll_flush(
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
fn poll_close(
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
[src]
self: Pin<&mut Self>,
cx: &mut Context
) -> Poll<Result<(), Self::Error>>
impl StructuralPartialEq for Message
[src]
Auto Trait Implementations
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,