#[non_exhaustive]pub struct AddressBook {
pub id: Id,
pub name: String,
pub description: Option<String>,
pub sort_order: u32,
pub is_default: bool,
pub is_subscribed: bool,
pub share_with: Option<BTreeMap<Id, AddressBookRights>>,
pub my_rights: AddressBookRights,
pub metadata: Option<Map<String, Value>>,
pub private_metadata: Option<Map<String, Value>>,
pub extra: Map<String, Value>,
}Expand description
A JMAP AddressBook object (RFC 9610 §2).
An AddressBook is a named collection of ContactCards. All ContactCards belong to one or more AddressBooks.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: IdServer-assigned immutable identifier.
name: StringUser-visible name; MUST NOT be empty and MUST NOT exceed 255 UTF-8 octets.
description: Option<String>Optional longer-form description (default: null).
Required-and-nullable per RFC 9553 + RFC 9610 §4.1: always present on
the wire as "description": null when unset. Must NOT use
skip_serializing_if.
sort_order: u32UI sort order; lower values display first. Range: [0, 2^31). Defaults to 0 per RFC 9610 §2.
is_default: boolTrue for at most one AddressBook per account; server-set.
is_subscribed: boolTrue if the user has subscribed to this AddressBook.
Map of principal id → rights for principals this AddressBook is shared with.
Required-and-nullable (RFC 9610 §2 type: Id[AddressBookRights]|null):
always present in wire JSON; serializes as null when not shared.
The spec §4.1 example shows "shareWith": null explicitly — never absent.
my_rights: AddressBookRightsACL rights the authenticated user has on this AddressBook; server-set.
metadata: Option<Map<String, Value>>Shared metadata, keyed by namespace identifier
(draft-ietf-jmap-metadata-04 §2). Each value is a JSON object (§2.1).
None when absent, which -04 §2 treats as {}; in an update a
null value “is equivalent to {}” (-04 §3.2) and also decodes as
None.
private_metadata: Option<Map<String, Value>>The authenticated user’s own metadata, keyed by namespace
identifier (draft-ietf-jmap-metadata-04 §2). Same shape and None
handling as metadata.
extra: Map<String, Value>Catch-all for vendor / site / private extension fields not covered by the typed fields above. Preserves unknown fields across deserialize/serialize round-trip per workspace extras-preservation policy (see workspace AGENTS.md).
See ContactCard::extra for the
collision contract: programmatically inserting a key that
matches a typed field name produces a duplicate JSON object key
on serialize. JMAP-glx8.19.
See AddressBook::validate_extras for a runtime pre-serialize
check that detects this hazard. JMAP-glx8.25.
Implementations§
Source§impl AddressBook
impl AddressBook
Sourcepub fn validate_extras(&self) -> Result<(), CollisionError>
pub fn validate_extras(&self) -> Result<(), CollisionError>
Check that no extra key shadows a typed
wire-format field of this struct. Returns
Err(CollisionError) listing any colliding
keys; otherwise returns Ok(()). See
ContactCard::validate_extras
for the design rationale. JMAP-glx8.25.
§Errors
Returns CollisionError when one or more keys in
extra match one of the camelCase wire-format
names of this struct’s typed fields.
Trait Implementations§
Source§impl Clone for AddressBook
impl Clone for AddressBook
Source§impl Debug for AddressBook
impl Debug for AddressBook
Source§impl<'de> Deserialize<'de> for AddressBook
impl<'de> Deserialize<'de> for AddressBook
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl GetObject for AddressBook
Source§impl JmapObject for AddressBook
impl JmapObject for AddressBook
Source§impl PartialEq for AddressBook
impl PartialEq for AddressBook
Source§impl Serialize for AddressBook
impl Serialize for AddressBook
Source§impl SetObject for AddressBook
RFC 9610 §2 (rfc9610.txt:167, 191, 221): id is “(immutable;
server-set)”; isDefault and myRights are “(server-set)”.
impl SetObject for AddressBook
RFC 9610 §2 (rfc9610.txt:167, 191, 221): id is “(immutable;
server-set)”; isDefault and myRights are “(server-set)”.
draft-ietf-jmap-metadata-04 §3.2: clients write metadata and
privateMetadata through Foo/set.
Source§const SERVER_SET: &'static [&'static str]
const SERVER_SET: &'static [&'static str]
/set method text never accepts from a
client, on create or update, is server-set too. Read moreSource§const CLIENT_SETTABLE: &'static [&'static str]
const CLIENT_SETTABLE: &'static [&'static str]
SERVER_SET: the ones a
client may set through /set. Read moreSource§const IMMUTABLE: &'static [&'static str]
const IMMUTABLE: &'static [&'static str]
CLIENT_SETTABLE properties the spec marks “immutable”: “The
value MUST NOT change after the object is created.” (RFC 8620 §1.1).
A property the /set method text accepts on create but not on update
is immutable too. Read more