Skip to main content

AttachedView

Struct AttachedView 

Source
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

Source

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.

Source

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.

Source

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).

Source

pub const fn definition(&self) -> &'static ApplicationDefinition

The app whose view this is.

Source

pub const fn checkout(&self) -> &RecordCheckout

The record the view holds.

Source

pub fn me(&self) -> &str

Who acts through the view.

Source

pub fn set_permissions(&mut self, permissions: PermissionContext)

The participant’s permissions changed: a role granted or taken away.

Source

pub fn resources(&self) -> Vec<Resource>

The tree the view publishes, as the participant may reach it.

Source

pub fn operations(&self) -> Vec<ActionDescriptor>

Every document operation the participant may perform through the view now, with its typed parameters.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn context(&self) -> Option<&ActionContext>

The task the participant carries out, when it has one.

Source

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.

Source

pub fn landed(&self) -> Option<ActionEnvelope>

The last action the view applied for the participant’s latest invocation: where its presence shows.

Source

pub fn read<R>(&self, read: impl FnOnce(&AutoCommit) -> R) -> Option<R>

Read the record’s document.

Source

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.

Source

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§

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,