pub struct PrivmsgBuilder { /* private fields */ }
Expand description
A builder for constructing a Message
or Privmsg
(and its raw
format)
use twitch_message::builders::PrivmsgBuilder;
use twitch_message::messages::{Privmsg, Message, MessageKind};
let builder = PrivmsgBuilder::default()
.channel("museun")
.sender("shaken_bot")
.data("~ Kappa");
let expected = ":shaken_bot!shaken_bot@shaken_bot.tmi.twitch.tv PRIVMSG #museun :~ Kappa\r\n";
let msg: Message<'_> = builder.clone().finish_message()?;
assert_eq!(msg.raw, expected);
assert_eq!(msg.kind, MessageKind::Privmsg);
let pm: Privmsg<'_> = builder.finish_privmsg()?;
assert_eq!(pm.raw, expected);
Implementations§
Source§impl PrivmsgBuilder
impl PrivmsgBuilder
Give it some optional tags
Sourcepub fn finish_privmsg(self) -> Result<Privmsg<'static>, PrivmsgBuilderError>
pub fn finish_privmsg(self) -> Result<Privmsg<'static>, PrivmsgBuilderError>
Construct a Privmsg
from this builder
Sourcepub fn finish_message(self) -> Result<Message<'static>, PrivmsgBuilderError>
pub fn finish_message(self) -> Result<Message<'static>, PrivmsgBuilderError>
Construct a Message
from this builder
Trait Implementations§
Source§impl Clone for PrivmsgBuilder
impl Clone for PrivmsgBuilder
Source§fn clone(&self) -> PrivmsgBuilder
fn clone(&self) -> PrivmsgBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for PrivmsgBuilder
impl Default for PrivmsgBuilder
Source§fn default() -> PrivmsgBuilder
fn default() -> PrivmsgBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PrivmsgBuilder
impl RefUnwindSafe for PrivmsgBuilder
impl Send for PrivmsgBuilder
impl Sync for PrivmsgBuilder
impl Unpin for PrivmsgBuilder
impl UnwindSafe for PrivmsgBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more