pub struct Setting<T> { /* private fields */ }Expand description
One typed settings value, kept current while the view lives: a write
from this window, another window, the Settings app or another of the
person’s devices (for Scope::Personal)
reaches Self::state on the next frame.
Bind controls to Self::state and write with Self::set. Settings
are not the document: they are not undone and never seen by
collaborators.
A section that is a resource model (#[derive(Model)] and an empty
#[resource]) is also a record its views edit by path
(ViewCx::record): its field edits and verbs
are published as settings:<kind>, each change is checked by the
model’s invariants and recorded in the settings document with what made
it and who.
Implementations§
Source§impl<T: SettingsSchema + Clone + PartialEq + Send + Sync> Setting<T>
impl<T: SettingsSchema + Clone + PartialEq + Send + Sync> Setting<T>
Sourcepub fn state(&self) -> LocalState<T>
pub fn state(&self) -> LocalState<T>
The value as state that follows every write.
Sourcepub fn set(&self, value: T) -> Result<()>
pub fn set(&self, value: T) -> Result<()>
Store value.
§Errors
When the document refuses it (see Settings::set); the value shown
stays the stored one.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Setting<T>
impl<T> RefUnwindSafe for Setting<T>
impl<T> Send for Setting<T>
impl<T> Sync for Setting<T>
impl<T> Unpin for Setting<T>
impl<T> UnsafeUnpin for Setting<T>
impl<T> UnwindSafe for Setting<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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