From 2a22902408ebd29bbc9236efda27436373dd40e2 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 31 Jul 2018 23:06:49 +0200 Subject: [PATCH] version: Split in query/response and document them. --- src/version.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/version.rs b/src/version.rs index 1265c16..c625892 100644 --- a/src/version.rs +++ b/src/version.rs @@ -4,19 +4,39 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#![deny(missing_docs)] + use iq::{IqGetPayload, IqResultPayload}; +generate_empty_element!( + /// Represents a query for the software version a remote entity is using. + /// + /// It should only be used in an ``, as it can only + /// represent the request, and not a result. + VersionQuery, "query", VERSION +); + +impl IqGetPayload for VersionQuery {} + generate_element!( - Version, "query", VERSION, + /// Represents the answer about the software version we are using. + /// + /// It should only be used in an ``, as it can only + /// represent the result, and not a request. + VersionResult, "query", VERSION, children: [ + /// The name of this client. name: Required = ("name", VERSION) => String, + + /// The version of this client. version: Required = ("version", VERSION) => String, + + /// The OS this client is running on. os: Option = ("os", VERSION) => String ] ); -impl IqGetPayload for Version {} -impl IqResultPayload for Version {} +impl IqResultPayload for VersionResult {} #[cfg(test)] mod tests {