[][src]Struct irc3::proto::message::Message

pub struct Message { /* fields omitted */ }

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]

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]

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.

impl<R> Sink<Message> for MessageTransport<R> where
    R: AsyncRead + AsyncWrite + Unpin
[src]

type Error = MessageTransportError

The type of value produced by the sink when an error occurs.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.