#[non_exhaustive]pub enum Metadata {
Annotation(Annotation),
ImapMetadata(ImapMetadata),
WebDavMetadata(WebDavMetadata),
}Expand description
A JMAP Metadata object (draft-ietf-jmap-metadata-01 §2).
The spec defines three concrete object types — Annotation,
ImapMetadata, and WebDavMetadata — all discriminated by the
@type property. This enum is serialised with @type as the internal
tag, matching the wire format defined by §2.1.
Additional metadata types MAY be defined by future specifications
(§2.1). Such future types will require new variants on this enum; the
#[non_exhaustive] derive keeps that non-breaking.
§Wire-format examples
{ "@type": "Annotation", "id": "MD1", "relatedType": "Mailbox",
"relatedId": "MB1", "isPrivate": true,
"acme.example.com:color": "blue" }
{ "@type": "ImapMetadata", "id": "MD2", "relatedType": "Mailbox",
"relatedId": "MB1", "isPrivate": false,
"metadata": { "comment": "Team mailbox" } }
{ "@type": "WebDavMetadata", "id": "MD3", "relatedType": "FileNode",
"relatedId": "F1", "isPrivate": false,
"metadata": { "{DAV:}displayname": "Project Documents" } }Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Annotation(Annotation)
General-purpose vendor metadata (draft-ietf-jmap-metadata-01 §2.1.1).
ImapMetadata(ImapMetadata)
IMAP RFC 5464 mapping (draft-ietf-jmap-metadata-01 §2.1.2).
WebDavMetadata(WebDavMetadata)
WebDAV RFC 4918 dead-property mapping (draft-ietf-jmap-metadata-01 §2.1.3).
Implementations§
Source§impl Metadata
impl Metadata
Return the relatedType property common to every Metadata variant,
or None if the wire input omitted it.
The spec marks relatedType mandatory for full Metadata objects per
§2.2.1.3, but the /get partial-response shape defined by §4.1
legitimately omits it: §4.1 lists only @type and relatedId as
the properties a server MUST always include, regardless of the
caller’s metadataProperties filter. The §7.2 example response
demonstrates this wire shape. This accessor therefore returns
Option<&str>. Callers that have a complete Metadata record
(created via Metadata/set) can .expect() here; callers
consuming partial responses from extended-/get should handle
the None arm — typically by inferring the type from the
related-object context.
Return the relatedId property common to every Metadata variant.
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Return the isPrivate property common to every Metadata variant
(defaulting to false per §2.2.1.5 when the inner field is None).