From 5338cd659909aefa2e3b916abe152c88336258c3 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 12 Oct 2019 17:14:00 +0200 Subject: [PATCH] pubsub: Add a constructor for items request. --- src/pubsub/pubsub.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pubsub/pubsub.rs b/src/pubsub/pubsub.rs index 8faf9c43..39b30c74 100644 --- a/src/pubsub/pubsub.rs +++ b/src/pubsub/pubsub.rs @@ -113,6 +113,18 @@ generate_element!( ] ); +impl Items { + /// Create a new items request. + pub fn new(node: &str) -> Items { + Items { + node: NodeName(String::from(node)), + max_items: None, + subid: None, + items: Vec::new(), + } + } +} + /// Response wrapper for a PubSub ``. #[derive(Debug, Clone)] pub struct Item(pub PubSubItem);