Struct irc_rust::MessageBuilder[][src]

pub struct MessageBuilder<'a> { /* fields omitted */ }

A MessageBuilder for a simpler generation of a message instead of building an string first.

Implementations

impl<'a> Message<'a>[src]

pub fn new(command: &'a str) -> Self[src]

Creates a new empty builder.

pub fn command(self, cmd: &'a str) -> Message<'a>[src]

Set the command.

Panics

Panics if cmd is empty.

pub fn tag(self, key: &'a str, value: &'a str) -> Message<'a>[src]

Set a tag.

Panics

Panics if key is empty. value is allowed to be empty.

pub fn prefix(
    self,
    name: &'a str,
    user: Option<&'a str>,
    host: Option<&'a str>
) -> Message<'a>
[src]

Set a prefix name.

Panics

Panics if name is empty, user or host == Some(“”) or user is some and host is none.

pub fn param(self, param: &'a str) -> Message<'a>[src]

Add a param.

Panics

Panics if param is empty.

pub fn set_param(self, index: usize, param: &'a str) -> Message<'a>[src]

Set a param at the given index. If the index is below 0, it won’t be set. If index >= length of the existing parameters it will be added to the end but not set as trailing. This doesn’t allow to set the trailing parameter.

Panics

Panics if param is empty.

pub fn remove_param(self, index: usize) -> Message<'a>[src]

pub fn trailing(self, trailing: &'a str) -> Message<'a>[src]

pub fn build(self) -> Message[src]

Create a Message instance and return if valid.

Trait Implementations

impl<'a> Clone for Message<'a>[src]

impl<'a> Debug for Message<'a>[src]

impl<'a> Default for Message<'a>[src]

impl<'a> Eq for Message<'a>[src]

impl<'a> PartialEq<Message<'a>> for Message<'a>[src]

impl<'a> StructuralEq for Message<'a>[src]

impl<'a> StructuralPartialEq for Message<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Message<'a>

impl<'a> Send for Message<'a>

impl<'a> Sync for Message<'a>

impl<'a> Unpin for Message<'a>

impl<'a> UnwindSafe for Message<'a>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.