From 87af0f36155aed0ea6bf003ea6c03061a17f87bd Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 20 Jul 2017 23:10:13 +0100 Subject: [PATCH] message, presence, iq: Improve documentation. --- src/iq.rs | 1 + src/lib.rs | 12 ++++++++++-- src/message.rs | 1 + src/presence.rs | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/iq.rs b/src/iq.rs index aed6a83..aab1efc 100644 --- a/src/iq.rs +++ b/src/iq.rs @@ -190,6 +190,7 @@ impl<'a> IntoAttributeValue for &'a IqType { } } +/// The main structure representing the `` stanza. #[derive(Debug, Clone)] pub struct Iq { pub from: Option, diff --git a/src/lib.rs b/src/lib.rs index 35dacab..359ba7b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,7 +58,11 @@ macro_rules! generate_attribute { ($elem:ident, $name:tt, {$($a:ident => $b:tt),+}) => ( #[derive(Debug, Clone, PartialEq)] pub enum $elem { - $($a),+ + $( + #[doc=$b] + #[doc="value for this attribute."] + $a + ),+ } impl FromStr for $elem { type Err = Error; @@ -80,7 +84,11 @@ macro_rules! generate_attribute { ($elem:ident, $name:tt, {$($a:ident => $b:tt),+}, Default = $default:ident) => ( #[derive(Debug, Clone, PartialEq)] pub enum $elem { - $($a),+ + $( + #[doc=$b] + #[doc="value for this attribute."] + $a + ),+ } impl FromStr for $elem { type Err = Error; diff --git a/src/message.rs b/src/message.rs index bbb6a5e..ea56042 100644 --- a/src/message.rs +++ b/src/message.rs @@ -115,6 +115,7 @@ type Body = String; type Subject = String; type Thread = String; +/// The main structure representing the `` stanza. #[derive(Debug, Clone)] pub struct Message { pub from: Option, diff --git a/src/presence.rs b/src/presence.rs index 098c401..fe970e3 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -186,6 +186,7 @@ impl IntoAttributeValue for Type { } } +/// The main structure representing the `` stanza. #[derive(Debug, Clone)] pub struct Presence { pub from: Option,