pub struct PersonRecord<P: Resource> { /* private fields */ }Expand description
A resource of the person’s own, kept in their own room: what they watched, the words they taught the keyboard, where they stopped reading. It follows them to their other devices and never reaches a collaborator, whatever room the app is open in.
It is a resource like the app’s own: its edits are its actions, applied
by the replayable executor, attributed to the person, written into its
history and undone per step (Self::undo). One record per resource
kind and app, the same on every device, created with the resource’s
genesis (Resource::initialize) where it does not exist yet. Read it
through Self::state or Self::with; an edit from another window or
device reaches it on the next frame.
Implementations§
Source§impl<P: Resource> PersonRecord<P>
impl<P: Resource> PersonRecord<P>
Sourcepub fn state(&self) -> LocalState<Rc<P::State>>
pub fn state(&self) -> LocalState<Rc<P::State>>
The state as view state that follows every change, for a control bound to it.
Sourcepub fn apply(&self, action: &P::Action) -> Result<(), ActionError>
pub fn apply(&self, action: &P::Action) -> Result<(), ActionError>
Apply action now: one change of the record, attributed to the
person, recorded in its history and — for content the person made —
one undo step of theirs.
§Errors
The action refused to apply, or the record is unavailable.
Sourcepub fn invoke(&self, invoke: &Invoke<P>) -> Result<(), ActionError>
pub fn invoke(&self, invoke: &Invoke<P>) -> Result<(), ActionError>
Apply the action invoke names, as Self::apply.
§Errors
The arguments do not build the action, or it refused to apply.
Sourcepub fn editable(&self) -> bool
pub fn editable(&self) -> bool
Whether this app changes the record: its own, or a shared one it is an editor of; any other is read here.
Sourcepub fn syncs(&self) -> bool
pub fn syncs(&self) -> bool
Whether the record reaches the person’s other devices: they have a root identity, so it lives in their room. Without one it is kept on this device only.
Sourcepub fn content(&self) -> Option<ContentStore>
pub fn content(&self) -> Option<ContentStore>
Where the content this record references — a picture its state
names by hash — is stored and read. It lives with the record, on the
person’s devices, never in the room of the window showing it; None
on a device that knows no person, whose records keep no content.
Sourcepub fn record(&self) -> &StoredRecord
pub fn record(&self) -> &StoredRecord
The record underneath, for a test or host that carries it between devices itself.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for PersonRecord<P>
impl<P> !RefUnwindSafe for PersonRecord<P>
impl<P> !Send for PersonRecord<P>
impl<P> !Sync for PersonRecord<P>
impl<P> Unpin for PersonRecord<P>
impl<P> UnsafeUnpin for PersonRecord<P>
impl<P> !UnwindSafe for PersonRecord<P>
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> 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