Skip to main content

I18nSet

Struct I18nSet 

Source
pub struct I18nSet { /* private fields */ }
Expand description

How a Foo/set handler treats locale and localizations (draft-atwood-jmap-updates-00 §3, §4.1).

Build one per request with I18nSet::new. Call I18nSet::check_create on each create object and I18nSet::check_patch on each update patch before handing them to the backend, and I18nSet::echo on each object returned in created or updated. The checks that need the patched object (a key equal to the new locale, pruning) run in the backend through localized_update, inside the same atomic update.

Implementations§

Source§

impl I18nSet

Source

pub fn new<O: JmapObject>(using: &[String], info: Option<&I18nInfo>) -> Self

The handling for type O, given the request’s using and the account’s JmapAccounts::i18n_info.

Source

pub fn check_create( &self, create: &mut Map<String, Value>, ) -> Result<(), Box<SetError>>

Check a create object and fold its tags to canonical case.

Without the capability in use, naming locale or localizations is invalidProperties (§3). With it, locale must be null or a language tag, and localizations must follow §4.1 (check_localizations) and the account’s I18nInfo::max_localizations. Length and syntax limits of the defining specification on localized values are the type’s handler’s to apply.

§Errors

An invalidProperties SetError naming locale or localizations.

Source

pub fn check_patch( &self, patch: &Map<String, Value>, ) -> Result<(), Box<SetError>>

Check an update patch before the backend applies it.

Without the capability in use, a patch path into locale or localizations is invalidProperties (§3). Everything that depends on the patched object is localized_update’s.

§Errors

An invalidProperties SetError naming locale or localizations.

Source

pub fn echo(&self, entry: &mut Value)

Shape a created or updated entry for the client: without the capability in use, locale and localizations are removed (§3); with it they are left as the backend returned them.

Trait Implementations§

Source§

impl Clone for I18nSet

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 I18nSet

Source§

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

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

impl Default for I18nSet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more