ibb: Add documentation.

This commit is contained in:
Emmanuel Gil Peyrot 2018-07-02 13:47:32 +02:00
commit 5f2062483a
2 changed files with 39 additions and 9 deletions

View file

@ -286,7 +286,8 @@ macro_rules! generate_empty_element {
}
macro_rules! generate_id {
($elem:ident) => (
($(#[$meta:meta])* $elem:ident) => (
$(#[$meta])*
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct $elem(pub String);
impl ::std::str::FromStr for $elem {
@ -338,10 +339,10 @@ macro_rules! generate_elem_id {
}
macro_rules! generate_element_with_text {
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, $text_ident:ident: $codec:ident < $text_type:ty >) => (
generate_element_with_text!($(#[$meta])* $elem, $name, $ns, [], $text_ident: $codec<$text_type>);
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, $(#[$text_meta:meta])* $text_ident:ident: $codec:ident < $text_type:ty >) => (
generate_element_with_text!($(#[$meta])* $elem, $name, $ns, [], $(#[$text_meta])* $text_ident: $codec<$text_type>);
);
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),*], $text_ident:ident: $codec:ident < $text_type:ty >) => (
($(#[$meta:meta])* $elem:ident, $name:tt, $ns:ident, [$($(#[$attr_meta:meta])* $attr:ident: $attr_type:ty = $attr_name:tt => $attr_action:tt),*], $(#[$text_meta:meta])* $text_ident:ident: $codec:ident < $text_type:ty >) => (
$(#[$meta])*
#[derive(Debug, Clone)]
pub struct $elem {
@ -349,6 +350,7 @@ macro_rules! generate_element_with_text {
$(#[$attr_meta])*
pub $attr: $attr_type,
)*
$(#[$text_meta])*
pub $text_ident: $text_type,
}