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:
parent
f2c3f45a6f
commit
bcd42a26e3
27 changed files with 162 additions and 137 deletions
|
|
@ -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",
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ generate_element!(
|
|||
Continue, "continue", MUC_USER,
|
||||
attributes: [
|
||||
/// The thread to continue in this room.
|
||||
thread: Option<String> = "thread" => optional,
|
||||
thread: Option<String> = "thread",
|
||||
]
|
||||
);
|
||||
|
||||
|
|
@ -187,16 +187,16 @@ generate_element!(
|
|||
/// An item representing a user in a room.
|
||||
Item, "item", MUC_USER, attributes: [
|
||||
/// The affiliation of this user with the room.
|
||||
affiliation: Affiliation = "affiliation" => required,
|
||||
affiliation: Required<Affiliation> = "affiliation",
|
||||
|
||||
/// The real JID of this user, if you are allowed to see it.
|
||||
jid: Option<Jid> = "jid" => optional,
|
||||
jid: Option<Jid> = "jid",
|
||||
|
||||
/// The current nickname of this user.
|
||||
nick: Option<String> = "nick" => optional,
|
||||
nick: Option<String> = "nick",
|
||||
|
||||
/// The current role of this user.
|
||||
role: Role = "role" => required
|
||||
role: Required<Role> = "role",
|
||||
], children: [
|
||||
/// The actor affected by this item.
|
||||
actor: Option<Actor> = ("actor", MUC_USER) => Actor,
|
||||
|
|
|
|||
Loading…
Reference in a new issue