macros: Use a nicer syntax when declaring attributes.

The previous version had a => required|optional|default token, this was
duplicating information for Option types and didn’t look very good.

This new version looks like a type, which can be either Required<_>,
Option<_> or Default<_>, and means the same thing.
This commit is contained in:
Emmanuel Gil Peyrot 2019-02-24 20:26:40 +01:00
commit bcd42a26e3
27 changed files with 162 additions and 137 deletions

View file

@ -14,16 +14,16 @@ generate_element!(
History, "history", MUC,
attributes: [
/// How many characters of history to send, in XML characters.
maxchars: Option<u32> = "maxchars" => optional,
maxchars: Option<u32> = "maxchars",
/// How many messages to send.
maxstanzas: Option<u32> = "maxstanzas" => optional,
maxstanzas: Option<u32> = "maxstanzas",
/// Only send messages received in these last seconds.
seconds: Option<u32> = "seconds" => optional,
seconds: Option<u32> = "seconds",
/// Only send messages after this date.
since: Option<DateTime> = "since" => optional,
since: Option<DateTime> = "since",
]
);