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,
room: &str,
checkout: RecordCheckout,
document: Vec<u8>,
me: &str,
permissions: PermissionContext,
created: bool,
) -> Result<Self, String>
pub fn open( definition: &'static ApplicationDefinition, room: &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
room, for me with permissions. created when me just created
the record, so the first Self::take_changes sends it whole.
§Errors
Returns why the record could not be held or the view would not open over it.
Sourcepub fn open_for(
definition: &'static ApplicationDefinition,
room: &str,
checkout: RecordCheckout,
document: Vec<u8>,
invoker: &ActionInvoker,
permissions: PermissionContext,
created: bool,
) -> Result<Self, String>
pub fn open_for( definition: &'static ApplicationDefinition, room: &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,
room: &'a str,
checkout: RecordCheckout,
document: Vec<u8>,
) -> OpenView<'a>
pub fn opening<'a>( definition: &'static ApplicationDefinition, room: &'a str, checkout: RecordCheckout, document: Vec<u8>, ) -> OpenView<'a>
The view of definition over the record document holds in room,
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.
Sourcepub const fn checkout(&self) -> &RecordCheckout
pub const fn checkout(&self) -> &RecordCheckout
The record the view holds.
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<Resource>
pub fn resources(&self) -> Vec<Resource>
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.
§Errors
The door’s refusal: an address the view does not offer the participant, a needed confirmation, bad arguments, or the action’s own failure.
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 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_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).
§Errors
Returns why the record store refused the peer’s document.
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> 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