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

@ -18,13 +18,13 @@ generate_element!(
Conference, "conference", BOOKMARKS,
attributes: [
/// Whether a conference bookmark should be joined automatically.
autojoin: Autojoin = "autojoin" => default,
autojoin: Default<Autojoin> = "autojoin",
/// The JID of the conference.
jid: Jid = "jid" => required,
jid: Required<Jid> = "jid",
/// A user-defined name for this conference.
name: String = "name" => required
name: Required<String> = "name",
],
children: [
/// The nick the user will use to join this conference.
@ -40,10 +40,10 @@ generate_element!(
Url, "url", BOOKMARKS,
attributes: [
/// A user-defined name for this URL.
name: String = "name" => required,
name: Required<String> = "name",
/// The URL of this bookmark.
url: String = "url" => required
url: Required<String> = "url",
]
);