From 2571aa7666055c548f7c99f96a86008c12e9650f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 19 Jul 2017 00:21:44 +0100 Subject: [PATCH] presence: Add with_ helpers to build a Presence --- src/presence.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/presence.rs b/src/presence.rs index e74a6e2..30a2615 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -211,6 +211,36 @@ impl Presence { payloads: vec!(), } } + + pub fn with_from(mut self, from: Option) -> Presence { + self.from = from; + self + } + + pub fn with_to(mut self, to: Option) -> Presence { + self.to = to; + self + } + + pub fn with_id(mut self, id: Option) -> Presence { + self.id = id; + self + } + + pub fn with_show(mut self, show: Show) -> Presence { + self.show = show; + self + } + + pub fn with_priority(mut self, priority: i8) -> Presence { + self.priority = priority; + self + } + + pub fn with_payloads(mut self, payloads: Vec) -> Presence { + self.payloads = payloads; + self + } } impl TryFrom for Presence {