Skip to main content

HostDocument

Struct HostDocument 

Source
pub struct HostDocument { /* private fields */ }

Implementations§

Source§

impl HostDocument

Source

pub fn new( initial: Map<String, Value>, persist: impl Fn(&Map<String, Value>) -> Result<()> + Send + Sync + 'static, ) -> Self

Trait Implementations§

Source§

impl SettingsSource for HostDocument

Source§

fn load(&self) -> Map<String, Value>

Source§

fn update_section(&self, name: &str, values: Map<String, Value>) -> Result<()>

Source§

fn update_section_with( &self, name: &str, _origin: &ChangeOrigin, change: &mut SectionChange<'_>, ) -> Result<()>

Read section name and merge what change makes of it, recording origin, as one step no other write to this source lands inside. This is the read-modify-write behind a typed key’s update: a toggle pressed twice in quick succession flips twice. Read more
Source§

fn update_sections( &self, sections: Vec<(String, Map<String, Value>)>, _origin: &ChangeOrigin, ) -> Result<()>

Merge each of sections as one change made by origin: one step history takes back together, a choice spanning sections (the model agents answer with) included. Read more
Source§

fn compare_update_sections( &self, expected: &[(&str, Map<String, Value>)], sections: Vec<(String, Map<String, Value>)>, _origin: &ChangeOrigin, ) -> Result<ConditionalUpdate>

Self::update_sections, only if each of expected (a section, and what it held when the caller read it) still holds what it did. Superseded means a newer change replaced what the caller read. Read more
Source§

fn revision(&self) -> u64

Source§

fn changes(&self) -> &ChangeSignal

Rings every time Self::revision changes, so a reader waiting for a change wakes at once instead of looking again and again.
Source§

fn update_section_by( &self, name: &str, values: Map<String, Value>, origin: &ChangeOrigin, ) -> Result<()>

Source§

fn readonly_refusal( &self, _name: &str, _values: &Map<String, Value>, ) -> Option<String>

Why writing values to section name is refused — a field the section declares read only would change — asked before the settings channel writes an app’s values there. The field is changed by the action a section declares and by nothing else, so no app’s write reaches it. None from a source that keeps no such declarations.
Source§

fn step( &self, _section: &str, _app: Option<&str>, _undo: bool, _invokers: &[String], ) -> Result<bool>

Take back (undo) or bring back the last step any of invokers (actors, as a change names them) took on section section, of the app app where the section keeps each app’s preferences apart. Whether there was one. Read more
Source§

fn stamps(&self, _section: &str) -> Result<Vec<Stamp>>

The changes of section section, oldest first, each as the stamp it carries in the settings’ history (or will, once written): which setter set what, and who invoked it. Read more
Source§

fn flush_pending(&self)

Source§

fn take_deferred_failures(&self) -> Vec<DeferredFailure>

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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