From f4084bcc83a8dcee5e747f9f245a06e694a010aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Tue, 27 Dec 2022 12:52:24 +0100 Subject: [PATCH] parsers: with_ helpers for muc::user::Item MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- parsers/src/muc/user.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/parsers/src/muc/user.rs b/parsers/src/muc/user.rs index 2f3660f..3c7390d 100644 --- a/parsers/src/muc/user.rs +++ b/parsers/src/muc/user.rs @@ -225,6 +225,38 @@ impl Item { reason: None, } } + + /// Set a jid for this Item + pub fn with_jid>(mut self, jid: J) -> Item { + self.jid = Some(jid.into()); + self + } + + /// Set a nick for this Item + pub fn with_nick>(mut self, nick: S) -> Item { + self.nick = Some(nick.into()); + self + } + + /// Set an actor for this Item + pub fn with_actor(mut self, actor: Actor) -> Item { + self.actor = Some(actor); + self + } + + /// Set a continue value for this Item + pub fn with_continue>(mut self, continue_: S) -> Item { + self.continue_ = Some(Continue { + thread: Some(continue_.into()), + }); + self + } + + /// Set a reason for this Item + pub fn with_reason>(mut self, reason: S) -> Item { + self.reason = Some(Reason(reason.into())); + self + } } generate_element!(