pub struct AttachedView { /* private fields */ }Expand description
One record held in its app’s view, attached and never drawn. See the module docs.
Implementations§
Source§impl AttachedView
impl AttachedView
Sourcepub fn open(
definition: &'static ApplicationDefinition,
workspace: &str,
checkout: RecordCheckout,
document: Vec<u8>,
me: &str,
permissions: PermissionContext,
created: bool,
) -> Result<Self, String>
pub fn open( definition: &'static ApplicationDefinition, workspace: &str, checkout: RecordCheckout, document: Vec<u8>, me: &str, permissions: PermissionContext, created: bool, ) -> Result<Self, String>
Mount definition’s view over the record document holds in
workspace, for me with permissions. created when me just created
the record, so the first Self::take_changes sends it whole.
Sourcepub fn open_for(
definition: &'static ApplicationDefinition,
workspace: &str,
checkout: RecordCheckout,
document: Vec<u8>,
invoker: &ActionInvoker,
permissions: PermissionContext,
created: bool,
) -> Result<Self, String>
pub fn open_for( definition: &'static ApplicationDefinition, workspace: &str, checkout: RecordCheckout, document: Vec<u8>, invoker: &ActionInvoker, permissions: PermissionContext, created: bool, ) -> Result<Self, String>
Self::open for invoker — an agent, say, which may act for a
person — rather than a person by their id alone. Its changes are
written under the record writer’s actor for its handle on this host.
§Errors
As Self::open.
Sourcepub fn opening<'a>(
definition: &'static ApplicationDefinition,
workspace: &'a str,
checkout: RecordCheckout,
document: Vec<u8>,
) -> OpenView<'a>
pub fn opening<'a>( definition: &'static ApplicationDefinition, workspace: &'a str, checkout: RecordCheckout, document: Vec<u8>, ) -> OpenView<'a>
The view of definition over the record document holds in workspace,
to open once said for whom, with what and what the host lends it
(OpenView).
Sourcepub const fn definition(&self) -> &'static ApplicationDefinition
pub const fn definition(&self) -> &'static ApplicationDefinition
The app whose view this is.
pub const fn checkout(&self) -> &RecordCheckout
Sourcepub fn set_permissions(&mut self, permissions: PermissionContext)
pub fn set_permissions(&mut self, permissions: PermissionContext)
The participant’s permissions changed: a role granted or taken away.
Sourcepub fn resources(&self) -> Vec<ResourceSpec>
pub fn resources(&self) -> Vec<ResourceSpec>
The tree the view publishes, as the participant may reach it.
Sourcepub fn operations(&self) -> Vec<ActionDescriptor>
pub fn operations(&self) -> Vec<ActionDescriptor>
Every document operation the participant may perform through the view now, with its typed parameters.
Sourcepub fn invoke(
&mut self,
address: &ActionAddress,
arguments: &Map<String, Value>,
confirmed: bool,
) -> Result<ActionOutput, DoorError>
pub fn invoke( &mut self, address: &ActionAddress, arguments: &Map<String, Value>, confirmed: bool, ) -> Result<ActionOutput, DoorError>
Perform the operation address names through the view, for the
participant: permission, confirmation and strict argument binding
exactly as for a person’s click (confirmed when the person it acts
for confirmed it). The change it made leaves with
Self::take_changes.
Sourcepub fn invoke_appearing(
&mut self,
address: &ActionAddress,
arguments: &Map<String, Value>,
confirmed: bool,
appearance: Option<Appearance>,
) -> Result<ActionOutput, DoorError>
pub fn invoke_appearing( &mut self, address: &ActionAddress, arguments: &Map<String, Value>, confirmed: bool, appearance: Option<Appearance>, ) -> Result<ActionOutput, DoorError>
Self::invoke showing appearance, which the door already admitted
for this one invocation. None clears any appearance the view’s
context carried: only a door sets one.
§Errors
As Self::invoke.
Sourcepub fn invoker_appearing(&self, appearance: Option<Appearance>) -> ActionInvoker
pub fn invoker_appearing(&self, appearance: Option<Appearance>) -> ActionInvoker
Whom Self::invoke_appearing admits an operation for: the
participant, or the person the task says it acts for now, showing
appearance.
Sourcepub fn invoke_as(
&mut self,
invoker: ActionInvoker,
address: &ActionAddress,
arguments: &Map<String, Value>,
confirmed: bool,
) -> Result<ActionOutput, DoorError>
pub fn invoke_as( &mut self, invoker: ActionInvoker, address: &ActionAddress, arguments: &Map<String, Value>, confirmed: bool, ) -> Result<ActionOutput, DoorError>
Self::invoke for invoker, whom the host admitted for this one
invocation (an agent’s, delivered to the app that owns the record):
the operation and every edit it makes are theirs. Any operation the
view offers — a document action, or an edit at the invoker’s own
caret.
§Errors
As Self::invoke.
Sourcepub fn invoke_as_awaiting(
&mut self,
invoker: ActionInvoker,
address: &ActionAddress,
arguments: &Map<String, Value>,
confirmed: bool,
within: Duration,
) -> Result<ActionOutput, DoorError>
pub fn invoke_as_awaiting( &mut self, invoker: ActionInvoker, address: &ActionAddress, arguments: &Map<String, Value>, confirmed: bool, within: Duration, ) -> Result<ActionOutput, DoorError>
Self::invoke_as, waiting up to within for an operation that
runs as a job (rendering a picture, exporting a file’s worth) to end
and answering with what it ended as, where Self::invoke_as
answers a job at once with nothing: for a host that hands an
effect’s result back to whoever asked, an agent planning its next
step on it. A job still running when within is up is cancelled.
§Errors
As Self::invoke_as; the job’s failure or cancellation, or that it
did not end in time.
Sourcepub fn invoke_typed<R: Resource>(
&mut self,
invoke: &Invoke<R>,
confirmed: bool,
) -> Result<ActionOutput, DoorError>
pub fn invoke_typed<R: Resource>( &mut self, invoke: &Invoke<R>, confirmed: bool, ) -> Result<ActionOutput, DoorError>
Perform invoke, an action of the record’s resource R built from
its typed reference (Note::EDIT.with(..), Invoke::edit(..)),
through the view as Self::invoke does.
§Errors
As Self::invoke, and when invoke does not bind or the view
publishes no R.
Sourcepub fn invoke_at(
&mut self,
place: &Place,
address: &ActionAddress,
arguments: &Map<String, Value>,
confirmed: bool,
) -> Result<ActionOutput, DoorError>
pub fn invoke_at( &mut self, place: &Place, address: &ActionAddress, arguments: &Map<String, Value>, confirmed: bool, ) -> Result<ActionOutput, DoorError>
Self::invoke acting at place instead of at the participant’s
caret: place is given as the operation’s place parameter
(#[param(place)]), and the participant lands there.
§Errors
As Self::invoke; refused as invalid arguments when the operation
takes no place.
Sourcepub fn set_context(&mut self, context: Option<ActionContext>)
pub fn set_context(&mut self, context: Option<ActionContext>)
The task the participant carries out from now on (None: none),
recorded with each thing it does.
Sourcepub const fn context(&self) -> Option<&ActionContext>
pub const fn context(&self) -> Option<&ActionContext>
The task the participant carries out, when it has one.
Sourcepub fn record_run(
&mut self,
label: &str,
issued_by: Option<&str>,
decision: Option<&str>,
steps: &[RunStep],
) -> bool
pub fn record_run( &mut self, label: &str, issued_by: Option<&str>, decision: Option<&str>, steps: &[RunStep], ) -> bool
Record one instruction that changed several records as one run in
this record’s history: a marker, no content. Leaves with
Self::take_changes; whether anything was recorded.
Sourcepub fn landed(&self) -> Option<ActionEnvelope>
pub fn landed(&self) -> Option<ActionEnvelope>
The last action the view applied for the participant’s latest invocation: where its presence shows.
Sourcepub fn read<R>(&self, read: impl FnOnce(&AutoCommit) -> R) -> Option<R>
pub fn read<R>(&self, read: impl FnOnce(&AutoCommit) -> R) -> Option<R>
Read the record’s document.
Sourcepub fn take_changes(&mut self) -> Option<DocumentMutation>
pub fn take_changes(&mut self) -> Option<DocumentMutation>
The participant’s changes since the last call, or None. The first
call on a record the participant created returns it whole.
Sourcepub fn merge(&mut self, mutation: &DocumentMutation) -> Result<bool, String>
pub fn merge(&mut self, mutation: &DocumentMutation) -> Result<bool, String>
Merge a peer’s change into the view’s record. Incremental changes
that build on nothing this record holds belong to another record (or
arrived ahead of what they build on) and are left alone: Ok(false).
Sourcepub fn chains(&self) -> Vec<RecordCheckout>
pub fn chains(&self) -> Vec<RecordCheckout>
The chains of records the app keeps beside its own
(Chain), as the view publishes them: each chain’s
id and the kind of its parts.
Sourcepub fn beside(&self, record: &RecordId) -> Option<RecordCheckout>
pub fn beside(&self, record: &RecordId) -> Option<RecordCheckout>
record as the view holds it beside its own: a part of one of the
app’s chains (Self::chains), of that chain’s kind. None for
any other record.
Sourcepub fn records_beside(&self) -> Vec<RecordCheckout>
pub fn records_beside(&self) -> Vec<RecordCheckout>
The records the view holds beside its own: the parts of the app’s
chains (Self::chains) open here, as they sync on routes of their
own.
pub fn read_record<R>( &self, record: &RecordId, read: impl FnOnce(&AutoCommit) -> R, ) -> Option<R>
Sourcepub fn take_record_changes(
&mut self,
record: &RecordId,
) -> Option<DocumentMutation>
pub fn take_record_changes( &mut self, record: &RecordId, ) -> Option<DocumentMutation>
The participant’s changes to record, one the view holds beside
its own (Self::records_beside), since the last call: the whole
record the first time, for one the participant started.
Sourcepub fn merge_record(
&mut self,
record: &RecordId,
mutation: &DocumentMutation,
) -> Result<bool, String>
pub fn merge_record( &mut self, record: &RecordId, mutation: &DocumentMutation, ) -> Result<bool, String>
Merge a peer’s change into record, a part of one of the app’s
chains (Self::beside), opening it first when the view holds it
not yet (a part another device started). Changes that build on
nothing the part holds are left alone: Ok(false). Whether it
changed.
Auto Trait Implementations§
impl Freeze for AttachedView
impl !RefUnwindSafe for AttachedView
impl !Send for AttachedView
impl !Sync for AttachedView
impl Unpin for AttachedView
impl UnsafeUnpin for AttachedView
impl !UnwindSafe for AttachedView
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
§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> 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>, which can then be
downcast into Box<dyn 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>, which 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