Skip to main content

ViewCx

Struct ViewCx 

Source
pub struct ViewCx<R: Resource, T: 'static = <R as Resource>::State> { /* private fields */ }
Expand description

Everything a view needs: reads of the resource state, bindings of controls to actions, local state, and custom surfaces.

T is what this scope reads — the resource state at the root, one item in a row built by ViewCx::each.

Implementations§

Source§

impl<R: Resource, T: 'static> ViewCx<R, T>

Source

pub fn person_picker<B: Binds<R, Option<String>> + Clone>( &self, id: &'static str, label: String, nobody: String, value_of: impl Fn(&MentionCandidate) -> Option<String> + 'static, read: impl Fn(&T) -> Option<String> + 'static, action: B, ) -> Element

A chip showing whom the resource assigns read to — their avatar and name, or nobody while it names no one — that opens the workspace’s people and agents, each with their avatar, and invokes action with the value the record stores for the one picked (None for nobody). value_of is how the record names a member, None leaving one out; label names the control for assistive technology. Built again as the roster changes, so it offers whom the workspace names now, and as the record’s value changes, so the chip follows an assignment made anywhere.

Source§

impl<R: Resource, T: 'static> ViewCx<R, T>

Source

pub fn record<P: Resource>( &self, record: &impl OtherRecord<P>, part: impl FnOnce(&mut ViewCx<P>) -> Element, ) -> Option<Element>

A part of the view over another record than the app’s own — the person’s own record (RecordEnv::person), a settings section (RecordEnv::settings) — built like a view of that record: its controls bind the record’s paths (cx.checkbox("high-contrast", Appearance::paths().high_contrast)) and verbs, its edits go to that record as the person, recorded in its history, and the part follows every change of it. None where the record cannot be held (a view of a past version).

Source§

impl<R: Resource, T: 'static> ViewCx<R, T>

Source

pub fn record_actions<P: Resource>( &self, record: &impl OtherRecord<P>, ) -> Option<Actions<P>>

The published actions of another record than the app’s own, for controls a view builds outside a part over that record (Self::record): a hand widget bound to a settings section’s field edits. None where the record cannot be held.

Source§

impl<R: Resource, T: 'static> ViewCx<R, T>

Source

pub fn live(&self) -> &Live<R>

The live resource state, for reads a binding does not cover.

Source

pub fn permission_state(&self, need: ActionNeed) -> LocalState<bool>

Observe what this participant may do, without storing their role in the shared resource. Use this with Self::switch for an owner-only pane, or with a bound widget for a permission-specific label. Changes follow the host even when the document and write access stay unchanged. This controls presentation; the action door remains the authority.

Source

pub fn standing(&self) -> impl Fn() -> Option<Standing> + 'static

This participant’s standing in the workspace as the host keeps it when called (who they are, the workspace’s policy, what bounds them), for a runtime that decides its own invocations by the policy the door decides by. None outside a host.

Source

pub fn govern_state(&self) -> LocalState<bool>

Whether this participant may govern the workspace, observed: for an owner-only pane with Self::switch.

Source

pub fn arrived_state(&self) -> LocalState<bool>

Whether what the workspace holds has arrived, as state that follows its sync: until it does, a record this window joined may still be missing the content its creator wrote. Enable a choice made from that content (a free seat, the next number) with it, so nobody acts on a copy that is about to change under them. A view never writes on open to make up for it: only the record’s creator writes what it starts with.

Source

pub fn read_only_state(&self) -> LocalState<bool>

Whether this participant may only view, as state that follows role changes while the app runs.

Source

pub fn item(&self) -> Option<&Id>

The item this scope stands for, inside an Each row.

Source

pub fn history(&self, last: usize) -> LocalState<Vec<HistoryVersion>>

The resource’s last last versions, oldest first, kept current as the document moves: an in-app history list of what was done and by whom, each version addressable by the undo, restore and checkpoint actions every app publishes.

Source

pub fn read<V>(&self, read: impl FnOnce(Option<&T>) -> V) -> V

Read the scope’s value now (at build time). For values that must follow the resource, use a binding such as Self::text.

Source

pub fn local<V: Send + Sync + 'static>(&self, initial: V) -> LocalState<V>

Typed process-local view state: never persisted, shared or undone.

Source

pub fn on_open<O: Outcome>(&self, open: impl FnMut(&str) -> O + 'static)

Show the item a search hit opens: open runs with the hit’s anchor (a SearchEntry’s anchor) when the person picks the hit, or when an agent invokes the resource’s open action. Select the item, switch to its page, scroll it into view: set the LocalStates that show it, as the person’s own input would.

open may refuse an anchor it cannot show (a row that is gone) by returning Err; the person or agent is told why.

Source

pub fn on_open_item( &self, open: impl FnMut(&Id) -> Result<(), Refusal> + 'static, )

Show the item of the resource a search hit or an agent’s open names: open runs with its id, and refuses one it cannot show (an item that no longer exists), which the person or agent is told. Anchors that name no item of the resource are refused for it.

Source

pub fn reference( &self, app: &str, record: Option<&str>, reference: &ResourceRef, ) -> Chip

reference, which app keeps in record (None: the app’s own record of the workspace), as a chip that opens it where it lives (Dispatcher::open_reference): an issue reads #12 Title, a page its name. A click, Enter or Space, and assistive technology’s activate all open it; a refusal is told like any refused action.

Open the platform search with request, narrowed to this app or one part of it. Usually a control does this (Self::search_button); a custom handler calls Dispatcher::open_search on its dispatcher.

Source

pub fn search_button(&self, request: SearchRequest) -> Button

The search launcher for this view’s chrome: an icon button that opens the platform search with request. Apps never draw a search field.

Source

pub fn on_stage(&self, stage: impl FnMut(Option<&str>) + 'static)

Stage view state for a screenshot scenario: stage runs with the scenario’s name (None for a plain --shots) after the scenario’s actions applied and were laid out, and before the frame is captured. Set the LocalStates a scenario shows — a selection, an open dialog — the way the user’s input would. It never runs in a live window.

Source

pub fn text(&self, read: impl Fn(&T) -> String + 'static) -> Text

Text that always shows read of the resource.

Source

pub fn button( &self, label: impl Into<LabelKey>, submit: impl Submit<R>, ) -> Button

A button that submits one fully specified action: a verb with its arguments (Snippets::NEW_SNIPPET.with(..)), a field edit (p.favorite.set(true)) or a form (Form::submit).

Source

pub fn form<P: Params<Resource = R>>(&self) -> Form<P>

The form of the verb whose parameters are P (cx.form::<bookmarks::Add>()): local values, never synced or undone, that controls bind to with the parameters’ paths (cx.input(form.paths().url)) and a button submits as one invocation (cx.button("bookmarks-add", form.submit())). The same form is answered for P everywhere in this scope.

Source

pub fn input<M>(&self, field: impl Bindable<R, String, M>) -> TextInput

A text field for the text at field: a path into the record, whose committed edits replace it (Path::replace; the keystrokes of one word are one undo step), or into a form (Self::form).

Source

pub fn checkbox<M>( &self, label: impl Into<LabelKey>, field: impl Bindable<R, bool, M>, ) -> Checkbox

A checkbox for the flag at field, a path into the record or a form; toggling sets it.

Source

pub fn control<V, C, M>( &self, make: impl FnOnce(&LocalState<V>) -> C, field: impl Bindable<R, V, M>, ) -> C
where V: Settable + 'static, C: ActionControl<V>,

Any toolkit control for the value at field, a path into the record or a form, setting it with each committed value: cx.control(Slider::from_state, p.volume).

Source

pub fn bind_declarations( &self, bind: impl Fn(&R::State) -> Vec<ActionDecl<R>> + 'static, )

Publish edits bound to this view’s local state — the folder shown, the row selected — on the resource beside its declared actions, as typed builders of its action: bind runs whenever the published tree is read, with the current resource state, and reads the local state it captured. Invoking one dispatches what it builds through the same permission check, confirmation and undo as any other action. The binding lasts as long as this view scope (a row’s ends with the row); an id the resource already publishes keeps the resource’s action unless the bound one refines it (tilo_resource::bind_declaration).

Source

pub fn actions(&self) -> Actions<R>

The resource’s published actions, for binding controls built outside the view function: the rows a table, list or tree creates on demand.

Source

pub fn toolbar(&self) -> WindowBar<R>

The window’s bar, its entries bound to the record’s actions through this view’s dispatcher (super::WindowBar): the view declares what the window shows and does, and the framework makes the slots of it.

Source

pub fn value<V>(&self, read: impl Fn(&T) -> V + 'static) -> LocalState<V>
where V: PartialEq + Default + Clone + 'static,

A value that follows read of the resource, for any toolkit control built from a LocalState (Slider::from_state, Dropdown::from_state).

Source

pub fn control_with<V, C>( &self, make: impl FnOnce(&LocalState<V>) -> C, read: impl Fn(&T) -> V + 'static, action: impl Binds<R, V>, ) -> C
where V: PartialEq + Default + Clone + 'static, C: ActionControl<V>,

A toolkit control bound to a verb: it shows read of the resource and invokes action with each committed value, for a value that is a verb’s argument rather than a field (cx.control_with(TextInput::from_state, |p| p.shape(&node), Project::SET_SHAPE.map(..))). The control is disabled when the action is not published. A field of the record is bound by its path instead (Self::input, Self::checkbox, Self::control).

Source

pub fn switch<K>( &self, key: &LocalState<K>, part: impl Fn(&mut ViewCx<R, T>, &K) -> Element + 'static, ) -> Element
where K: Clone + PartialEq + 'static,

A part of the view chosen by view-local state — the detail pane of the selected item, the page of a wizard. The part is built again, with its own bindings, whenever key changes; the previous one is dropped.

Source

pub fn arriving<V, E>( &self, arriving: &Arriving<V, E>, part: impl Fn(&mut ViewCx<R, T>, &V) -> Element + 'static, ) -> ArrivingView
where V: Clone + 'static, E: Display + 'static,

A part of the view showing data that arrives later: a resource read that is not here yet, a query of another app, a file read on a worker (Arriving). part builds what shows once the data is there, with its own bindings, again whenever a newer answer lands; until then, and when the read fails, the framework shows the placeholder and the failure (ArrivingView), with every timing. Say what the content looks like with ArrivingView::shaped.

Source

pub fn mounts(&self) -> Mounts<R, T>

What mounts parts of this view later, while it runs: a window that shows a child window once work finished keeps it and builds the child through it. See Mounts.

Source

pub fn surface<S, E>(&self, surface: S) -> Element
where S: ResourceSurface<R, E> + 'static, E: Effect,

Host a custom widget or renderer that takes part through the ResourceSurface contract, answering its effect vocabulary E (none unless it implements ResourceSurface<R, E>).

Source

pub fn publishing(&self, publishes: Publishes<R>, content: Element) -> Element

content, publishing on the resource what Publishes says beside what its bindings publish: the live rows it shows, search entries for what the resource does not hold. It lasts as long as content stands in the view.

Source

pub fn upkeep(&self, upkeep: Upkeep, content: Element) -> Element

content, kept up as Upkeep says: the work the view takes in on every sync, the frames and wakes it owes the window, what a capture waits for, what it asks of the host and the presentation it keeps with the window. It lasts as long as content stands in the view.

Source

pub fn effects<E: Effect>( &self, handle: impl FnMut(E, &mut EffectCx<R>) -> EffectAnswer + 'static, ) -> EffectsHandle

Answer the effect vocabulary E — work with no document delta that a button, the palette, an agent or a script invokes — with handle, and publish E on the resource while this part of the view lives.

handle receives each invocation as a typed value. It finishes at once (Effected::done) or starts a job through the EffectCx (for an effect declared job); a job’s completion runs on the UI thread and changes the document through the context’s dispatcher. Handlers never run in History mode. Say which effects are unavailable or relabelled right now with EffectsHandle::status.

Source

pub fn window_effects<E: Effect, W: Widget + 'static>( &self, handle: impl FnMut(&mut W, E, &mut EffectCx<R>) -> EffectAnswer + 'static, ) -> EffectsHandle

Answer the effect vocabulary E on the window W the view laid out, as Self::effects does: handle gets the window itself for the call, so an effect answers at once from what the window shows (the page, the caret). The window is found by its type in the view’s tree when the effect starts; an effect invoked while it is not open is refused. What finishes later reaches state the window shares, or the window itself with Self::window_host_effects.

Source

pub fn window_host_effects<E: Effect, W: Widget + 'static>( &self, handle: impl FnMut(&mut W, E, &mut EffectCx<R, W>) -> EffectAnswer + 'static, ) -> EffectsHandle

Self::window_effects for a window that hosts its work, as a hosted surface does: the completions of the jobs its effects start get the window W too (EffectCx<R, W>). Work whose window is not in the view waits for it to show again; what is still running when this part of the view goes is stopped.

Source

pub fn jobs(&self) -> Jobs<R>

Jobs the view starts on its own, with nobody invoking an effect: a fetch when what it shows changes. See Jobs.

Source

pub fn window_jobs<W: Widget + 'static>(&self) -> Jobs<R>

Jobs the window W the view laid out starts on its own, whose completions get the window (jobs.start::<W>(…)), as a hosted surface’s get the surface. They finish before the view syncs, wait while the window is not in the view, and stop once this part of the view goes. See Jobs.

Source

pub fn effect_button<E: Effect>( &self, label: impl Into<LabelKey>, effect: &E, ) -> Button

A button that invokes one effect, through the same door (and the same confirmation, for a destructive one) as the palette.

Source§

impl<R: Resource, T: Model + 'static> ViewCx<R, T>

Source

pub fn paths(&self) -> T::Paths<R>

The typed paths of this scope’s value: the record’s fields at the root, the item’s in a row of Self::each. Controls bind to them (row.checkbox("snippets-favorite", p.favorite)) and edits are made at them (p.favorite.set(true)).

§Panics

Panics inside a row of a collection Self::each could not find among the fields of the value it was given.

Source

pub fn each<I: Model + 'static>( &self, items: impl Fn(&T) -> &Collection<I> + 'static, row: impl Fn(&mut ViewCx<R, I>) -> Element + 'static, ) -> Each<R>

One row per item of a collection, kept in collection order: cx.each(|snippets| &snippets.snippets, |row| ...). A row is built once per item and retained while the item exists, so focus and caret inside it survive other items changing; rows are added, removed and moved only when the collection’s membership changes. In a row, Self::paths are rooted at its item. A row’s context menu (right-click, the Menu key or Shift+F10) offers the actions the resource publishes on its item, with the item already bound.

Source§

impl<R, T: 'static> ViewCx<R, T>
where R: Resource<State = R> + Model,

Binding controls to the record’s fields by path.

Source

pub fn value_at<V>(&self, path: &Path<R, V>) -> LocalState<V>
where V: PartialEq + Default + Clone + 'static,

The value at path, as local state that follows it: for any toolkit control built from a LocalState, or a part of the view that shows it. It is read again only after changes that touched it.

Source

pub fn route_graph_text( &self, values: &UiValues, ui_path: &str, path: Path<R, String>, )

Route a serialized screen’s text inputs over ui_path to the text field at path (UiValues::route): they show it and each edit replaces it.

Source

pub fn route_graph_bool( &self, values: &UiValues, ui_path: &str, path: Path<R, bool>, )

Route a serialized screen’s checked controls over ui_path to the flag at path: they show it and each toggle sets it.

Source

pub fn control_map<V, I, C>( &self, make: impl FnOnce(&LocalState<I>) -> C, path: Path<R, V>, show: impl Fn(&V) -> I + 'static, store: impl Fn(I) -> V + Send + Sync + 'static, ) -> C
where V: Settable + PartialEq + Default + Clone + 'static, I: PartialEq + Clone + Send + Sync + 'static, C: ActionControl<I>,

A toolkit control whose value is not the field’s own type: a slider (f64) for an optional hue (Option<f64>), a dropdown of names for a flag. It shows show of the value at path and sets the field to store of each committed value: cx.control_map(Slider::from_state, p.hue, |hue| hue.unwrap_or(0.5), Some).

Methods from Deref<Target = RecordEnv<R>>§

Source

pub fn waker(&self) -> WakeHandle

Wakes the app from another thread — a worker’s result, a socket’s message — so the window syncs and draws it without waiting for input.

Source

pub fn open_here( &self, arguments: &[String], ) -> Result<ReplacementOutcome, String>

Open, in this window and in place of the record it shows, what a launch of the app naming arguments opens: the record ResourceApp::launch_record names, with its launch actions — the document a person chose with the app’s own Open. The window’s view is rebuilt for that record on the next frame. Refused in a past version and a capture.

The outcome answers once the host opened it, or why it could not.

Source

pub fn record_id(&self) -> Option<&RecordId>

The host-owned identity of the record this window shows. A durable activation link can name it without relying on the last-open window. Absent in a historical view that cannot launch live work.

Source

pub fn opener(&self) -> Option<OpenHere>

What Self::open_here does, kept for later: the input that asks for another record arrives after the view is built (a file chosen in a picker, a clicked notification). None in a past version and a capture.

Source

pub fn window_documents(&self) -> Vec<WindowDocument<R>>

The documents this app’s windows started in this workspace, each as last kept, the most recently changed first, without the one this window shows: what an app whose windows each show a document of their own (ResourceApp::WINDOW_RESOURCE) lists, so a document made in a window that was closed is reached again. Open one here with Self::open_here naming WindowDocument::uri. Reads every one of them, so ask when the list is shown, not on every frame. Empty in a past version and where the window keeps no records in a workspace.

Source

pub fn people(&self) -> People

The names of the participants, for showing the ids actions record (People::name).

Source

pub fn dispatcher(&self) -> Dispatcher<R>

Where edits go. Custom widgets keep a clone.

Source

pub fn child<C: Resource>( &self, id: &str, wrap: impl Fn(C::Action) -> R::Action + 'static, ) -> Dispatcher<C>

The dispatcher of the resource nested in this one at id, whose edits are this resource’s action wrap(edit): a rich-text body, a draft, a SQL buffer. See Dispatcher::child.

Source

pub fn chain<P: Chained<Base = R>>(&self) -> Option<Chain<P>>

The chain of P the app keeps beside its record (Chain): its parts, read as they change, and its dispatcher. None in a view of a past version, or where P’s base is not this record’s resource.

Source

pub fn chain_beside<P: Chained<Base = R>>( &self, beside: &WorkspaceRecord<R>, ) -> Option<Chain<P>>

The chain of P kept beside the record beside rather than beside this window’s own (Chained::chain_beside): the messages of one direct conversation, kept in the record the two people share. P’s base is the type of beside’s record.

Source

pub fn children<C: ChildRecord<Parent = R>>(&self) -> Option<Children<C>>

The children of C this record lists (Children): each a record of its own, read as they change, with the one lifecycle every container has. None in a view of a past version, or where C’s parent is not this record’s resource.

Source

pub fn me(&self) -> Option<&str>

Who this view is for: the participant reading and editing through it, the same id an action they invoke reads as its author (ActionCx::author). Compare the authors the resource records with it (“your message”, “you reacted”) instead of keeping the reader in the resource state, which is the same for everyone. None in a view of a past version.

Source

pub fn is_past(&self) -> bool

Whether this view shows a past version in History mode, drawn from a frozen document. It must start no work there: a surface that fetches, watches or spawns a worker is built without it and presents what the document holds.

Source

pub fn read_only(&self) -> bool

Whether this participant may only view, when the view is built. Bound controls already follow permission changes on their own; to show or disable something else while the participant may only view, bind to ViewCx::read_only_state, which follows role changes while the app runs.

Source

pub fn save_status(&self) -> LocalState<RecordSaveStatus>

Whether the record’s latest edits are durable, for automation and an accessibility status. Saving is automatic and the window already says what there is to say (a save that stalls or fails, and the document’s unsaved mark then): never show this as “Saving…” or “Saved”, nor mark the document edited from it.

Source

pub fn saves(&self) -> Saves

The window’s report of saves the app makes outside its record (a file it writes), presented with the record’s own on the window’s save status. See Saves.

Source

pub fn workspace(&self) -> Option<String>

The workspace the window keeps its records in: what an app keys what it keeps on this device for the workspace by (a cache, an index). None in a past version and where the window keeps no records in a workspace.

Source

pub fn workspace_handle(&self) -> Option<WorkspaceHandle>

The records every app of the window’s workspace opens, held for what settles after the view that asked for one (an action’s reply, a message from another device): a conversation’s record is opened and followed through it, in a view that is built once. None in a past version and where the window keeps no workspace records.

Source

pub fn mode(&self) -> RunMode

What the view is built for: a window someone uses, a past version in History, or a screenshot. Start work that reaches outside the process (an engine, a socket, a probe) only when it is live.

Source

pub fn fixture<V: 'static>(&self) -> Option<Rc<V>>

The capture’s stand-in for a live source of type V (Fixture::provide); None outside a capture, or when the scenario provides none.

Source

pub fn content(&self) -> Option<ContentStore>

The content store the host lent the app: opaque blobs by hash that outlive it. A capture’s holds the blobs its scenario put there.

Source

pub fn launch(&self) -> LaunchInput<'_>

What the launch that opened this window named — the file a person opened the app with, its command line — for a view that shows what the launch’s actions (ResourceApp::launch) made: the note a launch imported, opened. Empty for a plain start and for a past version.

Source

pub fn launch_arguments(&self) -> &[String]

What the window’s launch named (paths, URLs), for a view that acts on them beyond the actions the launch took: the file a save writes back to. Empty for a plain start, a past version and a capture.

Source

pub fn file_history(&self) -> Option<FileHistorySource>

The file whose history History shows beside the resource’s, for an app that declares ResourceApp::FILE_HISTORY: set its target to the file the window shows (the selected one) and open it from the window’s own History command. None for any other app, and in a past version.

Source

pub fn launch_option(&self, name: &str) -> Option<&str>

The value of the app’s own option name (--purpose) the window’s launch named; see ResourceApp::OPTIONS. None for a past version.

Source

pub fn launch_flag(&self, name: &str) -> bool

Whether the window’s launch named the app’s switch name; see ResourceApp::FLAGS.

Source

pub fn take_lent<S: 'static>(&self) -> Option<S>

The service of type T the host that mounts the app in its own process lent it (HostContext::lend), taken once: the shell’s connection to the session’s process supervisor for a terminal it hosts. None in the app’s own process, and for a past version or a capture, which start nothing.

Source

pub fn is_private(&self) -> bool

Whether the window is private (ResourceApp::PRIVATE_WINDOWS): its record, settings and files are thrown away with the process. A view keeps what it would otherwise remember on the device (visits, a session to restore) to itself.

Source

pub fn settings<S>(&self) -> Setting<S>

The app’s typed settings of type S, kept current while this scope lives. S declares whether they follow the person or stay on the device (Scope).

Source

pub fn device(&self) -> Option<&str>

The device this window runs on: stable across launches, distinct on each of the person’s devices. None in a view of a past version. An action that records where something happened (a speed test run on this device) takes it as an argument, so every replica applies the same value.

Source

pub fn query<T>( &self, target: RemoteActionTarget, argument: InvokeArgument, ) -> Query<T>
where T: DeserializeOwned + Send + Sync + 'static,

Read the result of the view action at target with argument, through the session’s action door as the person using the app, and keep it current (Query): a live action’s answer follows its provider’s changes, one that answers once is read once. It is followed while this scope lives.

Source

pub fn invoke(&self, target: RemoteActionTarget, argument: InvokeArgument)

Invoke the action at target of another provider with argument, through the session’s action door as the person using the app: a write a Self::query then reads back. Why it did not go ahead is told as any refused call of the window is. A past version or a capture invokes nothing.

Source

pub fn person<P: Resource>(&self) -> Option<PersonRecord<P>>

The app’s record of P (PersonRecord): one per kind, kept with the app’s other records in the workspace it is open in and synced with it. None where the host keeps no such records (a view of a past version, a private window) or the record cannot be opened.

Source

pub fn shared_workspace<P: Resource>( &self, owner: &'static str, ) -> Option<WorkspaceRecord<P>>

The record P that owner keeps in the window’s workspace and every app of the workspace opens (collab_types::WORKSPACE_RECORDS): the workspace’s emoji, which are Chat’s. Changes to it are decided by the workspace’s grants on owner’s resource. None where the host keeps no such records (a view of a past version) or it cannot be opened.

Source

pub fn shared_record<P: Resource>( &self, owner: &'static str, id: &str, ) -> Option<WorkspaceRecord<P>>

The record id of P that owner keeps in the window’s workspace, named otherwise than Self::shared_workspace’s: a conversation’s, which the two people it is between name. Held and decided like any record of the owner’s: the workspace’s grants on owner decide every change. None where the host keeps no records in a workspace (a view of a past version), for an id that names no record, or where it cannot be opened.

Source

pub fn shared_person<P: SharedRecord>(&self) -> Option<PersonRecord<P>>

The person’s record P that one app keeps for all of theirs — their accounts, which Settings keeps: the same record on every device, held here too and converging with the keeper’s. Changed only by its owner and editors (SharedRecord, PersonRecord::editable); its owner opens it here too.

Source

pub fn storage(&self) -> &AppStorage

The app’s files, secrets and settings documents, as its host gave them. A secret of one document item is cx.storage().secrets().item(purpose, id).

Source

pub fn outbox<E, O>( &self, outbox: Path<R, Outbox<E, O>>, owns: impl Fn(&R::State, &E) -> bool + 'static, run: impl FnMut(&Id, E, &mut EffectCx<R>) -> EffectAnswer + 'static, ) -> Projection
where R: Resource<State = R> + Model + 'static, E: Model + Clone + 'static, O: Serialize + DeserializeOwned + Default + 'static,

Carry out the entries of the Outbox at outbox that this device owns, and record how each settled.

Every replica holds the entries; owns says which are this device’s to carry out (the device whose disk a file operation names, the one holding the mail account). For each such pending entry the framework runs run in the live app — never in History or a capture — at once or as a job through its EffectCx, and records the answer with the outbox’s settle edit: content from outside, nobody’s undo step. The answer settles the entry: Effected::settled with how it went, Effected::value with the result O, or Effected::done for O’s default. An Err leaves the entry pending, to run again after the next change or when the returned Projection is told the outside changed (the server came back); a failure for good is a Settled::Failed.

Source

pub fn outbox_awaited<E, O>( &self, outbox: Path<R, Outbox<E, O>>, owns: impl Fn(&R::State, &E) -> bool + 'static, run: impl FnMut(&Id, E, &mut EffectCx<R>) -> EffectAnswer + 'static, ) -> Projection
where R: Resource<State = R> + Model + 'static, E: Model + Clone + 'static, O: Serialize + DeserializeOwned + Default + 'static,

Self::outbox, where an entry is the outside half of the action that queued it: one an admitted invocation on this device queues runs at once under that invocation — cx.invocation() names it, and its custody authorises what the handler does for it (a native host that acts only on behalf of an invocation) — and the invocation completes only once its entries settled, failing with a failed one. Entries queued elsewhere, replayed or still pending after a restart run as Self::outbox runs them, with no invocation.

Trait Implementations§

Source§

impl<R: Resource, T: 'static> Deref for ViewCx<R, T>

Source§

type Target = RecordEnv<R>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &RecordEnv<R>

Dereferences the value.

Auto Trait Implementations§

§

impl<R, T> Freeze for ViewCx<R, T>

§

impl<R, T = <R as Resource>::State> !RefUnwindSafe for ViewCx<R, T>

§

impl<R, T = <R as Resource>::State> !Send for ViewCx<R, T>

§

impl<R, T = <R as Resource>::State> !Sync for ViewCx<R, T>

§

impl<R, T> Unpin for ViewCx<R, T>

§

impl<R, T> UnsafeUnpin for ViewCx<R, T>

§

impl<R, T = <R as Resource>::State> !UnwindSafe for ViewCx<R, T>

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
§

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

§

fn as_any(&self) -> &(dyn Any + 'static)

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

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

§

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

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

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

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

Converts &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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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,