Skip to main content

Annotation

Struct Annotation 

Source
#[non_exhaustive]
pub struct Annotation { pub id: Option<Id>, pub related_type: Option<String>, pub related_id: Id, pub is_private: Option<bool>, pub extra: Map<String, Value>, }
Expand description

General-purpose vendor metadata (draft-ietf-jmap-metadata-01 §2.1.1).

The @type wire value is "Annotation"; it is supplied by the enclosing Metadata tag and does NOT appear as a field on this struct.

§Vendor-specific properties (§2.2.1.6)

Annotations are designed to carry arbitrary vendor-defined properties beyond the common fields below. Vendor properties MUST be prefixed with a domain name owned by the vendor, e.g. acme.example.com:color. Those fields are captured in extra and round-trip losslessly per the workspace extras-preservation policy.

§id is server-set

On Metadata/set create operations the client omits id; the server assigns it. id is Option<Id> so client-side request construction is natural.

§isPrivate default

Per §2.2.1.5 the default is false. The field is Option<bool> so callers can distinguish “explicitly false on the wire” from “absent”. Wire-omitted defaults to shared.

§relatedType is optional on the wire

Per §2.2.1.3 relatedType is mandatory on full Metadata objects, but the extended-/get partial-response shape defined by §4.1 omits it when the caller filtered it out via metadataProperties. §4.1 lists only @type and relatedId as always-included; everything else (including relatedType) is omittable. The §7.2 example response demonstrates this shape. To round-trip the wire format faithfully the field is Option<String>. Callers constructing a Metadata object for Metadata/set MUST populate relatedType (otherwise the server will reject with invalidProperties).

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: Option<Id>

Server-assigned identifier. Absent on create requests.

§related_type: Option<String>

JMAP type name of the related object (e.g. "Email", "Mailbox").

Mandatory per §2.2.1.3 on full Metadata objects, but omittable in the §4.1 extended-/get partial-response shape (the §7.2 example demonstrates this). None indicates the wire input omitted the field; callers consuming partial responses can infer the type from context (e.g. the data type whose /get produced the response). Callers constructing a Metadata object for Metadata/set MUST populate this field.

§related_id: Id

Identifier of the related JMAP object. Mandatory per §2.2.1.4.

§is_private: Option<bool>

Whether this annotation is private to the authenticated user. Default false per §2.2.1.5.

§extra: Map<String, Value>

Vendor-specific properties (§2.2.1.6) and any other extension fields not covered by the typed fields above.

Captures every JSON key on the wire that is not @type, id, relatedType, relatedId, or isPrivate. Vendor properties are domain-prefixed strings (e.g. acme.example.com:color) per the spec’s naming requirement.

Round-trips losslessly per the workspace extras-preservation policy (see workspace AGENTS.md). Empty-map case serialises to nothing, preserving wire-byte identity with the spec examples.

Trait Implementations§

Source§

impl Clone for Annotation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Annotation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Annotation

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Annotation

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Annotation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Annotation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.