pub struct HeadlessApp<A: ResourceApp> { /* private fields */ }Expand description
One framework app mounted headlessly: a test, a fixture seeder or an inspection tool drives it through the real runtime.
Implementations§
Source§impl<A: ResourceApp> HeadlessApp<A>
impl<A: ResourceApp> HeadlessApp<A>
Sourcepub fn content(&self) -> ContentStore
pub fn content(&self) -> ContentStore
The content store the app’s profile keeps the bytes its record names
in: what cx.content() reads and writes on this device.
Sourcepub fn new() -> Result<Self, LaunchError>
pub fn new() -> Result<Self, LaunchError>
The app as its owner opens it on a fresh private profile.
Sourcepub fn in_workspace(workspace: &str) -> Result<Self, LaunchError>
pub fn in_workspace(workspace: &str) -> Result<Self, LaunchError>
The app as its owner opens it on a fresh private profile, in workspace:
one of several windows of the app in one process, each in a workspace of
its own.
Sourcepub fn on_device(device: &str) -> Result<Self, LaunchError>
pub fn on_device(device: &str) -> Result<Self, LaunchError>
The app as its owner opens it on a fresh profile on the device
device: one of two devices sharing a record, each carrying out what
is queued for it.
Sourcepub fn with_role(role: Role) -> Result<Self, LaunchError>
pub fn with_role(role: Role) -> Result<Self, LaunchError>
The app as a participant with role opens it on a fresh profile.
Sourcepub fn hosted(
resource: &str,
answers: impl Answers + 'static,
) -> Result<Self, LaunchError>
pub fn hosted( resource: &str, answers: impl Answers + 'static, ) -> Result<Self, LaunchError>
The app as its owner opens it over answers, the session’s document
host: no record is opened here, the view reads the reading answers
publishes at resource, and everything it submits goes back to
answers (one-app-model.md §4).
Sourcepub fn for_person(person: &str) -> Result<Self, LaunchError>
pub fn for_person(person: &str) -> Result<Self, LaunchError>
The app as person (the hex of a root public key) opens it on a
fresh profile: one of that person’s devices, whose shared records
(RecordEnv::shared_person) are
theirs.
Sourcepub fn for_person_in(person: &str, workspace: &str) -> Result<Self, LaunchError>
pub fn for_person_in(person: &str, workspace: &str) -> Result<Self, LaunchError>
Self::for_person, with the app open in the workspace workspace
(a workspace id), whose records sync on their routes.
Sourcepub fn for_person_with_lent<S: 'static>(
person: &str,
service: S,
) -> Result<Self, LaunchError>
pub fn for_person_with_lent<S: 'static>( person: &str, service: S, ) -> Result<Self, LaunchError>
Open a fresh person profile with a service lent by its mounting host.
The loan follows production HostContext::lend and is not retained on
reopen: the next host must authorize and lend its own service again.
Sourcepub fn for_person_shown_by(
person: &str,
held: &PersonRecords,
) -> Result<Self, LaunchError>
pub fn for_person_shown_by( person: &str, held: &PersonRecords, ) -> Result<Self, LaunchError>
The app as person opens it in a host that keeps the person’s
shared records itself, in held, and lends them to the apps it
shows in its process (a session showing Settings).
Sourcepub fn open_person_records(&mut self) -> usize
pub fn open_person_records(&mut self) -> usize
How many of the person’s records the window holds open, the records a settings section keeps among them: a section’s opens only when it is first written or stepped.
Sourcepub fn person<P: Resource>(&mut self) -> Option<PersonRecord<P>>
pub fn person<P: Resource>(&mut self) -> Option<PersonRecord<P>>
The person’s own record of P the running app keeps, as its views
open it.
The record P every app of the workspace opens that owner keeps, as
the app’s views open it.
The record id that owner keeps, as the app’s views open it.
The person’s shared record P, as the app’s views open it.
Sourcepub fn capture(scenario: Option<&str>) -> Result<Self, LaunchError>
pub fn capture(scenario: Option<&str>) -> Result<Self, LaunchError>
The frame --shots --scenario writes for scenario (None for a
plain --shots): the app built for a capture on a fresh profile,
from the scenario’s fixture, with its actions applied and its view
state staged, at the scenario’s viewport.
Sourcepub fn capture_at(
scenario: Option<&str>,
viewport: (u32, u32),
) -> Result<Self, LaunchError>
pub fn capture_at( scenario: Option<&str>, viewport: (u32, u32), ) -> Result<Self, LaunchError>
Sourcepub fn drive(scenario: &str) -> Result<Self, LaunchError>
pub fn drive(scenario: &str) -> Result<Self, LaunchError>
The window --headless-drive drives when it names scenario
("scenario" in the spec, or --scenario NAME beside it): built and
staged as Self::capture is, from the scenario’s fixtures, but the
actions invoked on it run, as the drive’s invoke steps run them. It
starts no work on its own, so what it shows stays the scenario’s.
A drive that names no scenario drives the app someone uses
(Self::new).
§Errors
As Self::capture.
Sourcepub fn capture_launched(
scenario: Option<&str>,
arguments: &[&str],
) -> Result<Self, LaunchError>
pub fn capture_launched( scenario: Option<&str>, arguments: &[&str], ) -> Result<Self, LaunchError>
Self::capture of the app launched with arguments, as
--shots --scenario NAME ARGUMENTS draws it: a capture of a file the
app was launched on.
§Errors
As Self::capture.
Sourcepub fn launched(arguments: &[&str]) -> Result<Self, LaunchError>
pub fn launched(arguments: &[&str]) -> Result<Self, LaunchError>
The app launched by its owner with arguments, as app ARGUMENTS
on the command line: on the record ResourceApp::launch_record
names, after its ResourceApp::launch actions. The app’s own
options and switches
among them reach it as options.
Sourcepub fn launched_replica(
arguments: &[&str],
document: &mut Doc,
) -> Result<Self, LaunchError>
pub fn launched_replica( arguments: &[&str], document: &mut Doc, ) -> Result<Self, LaunchError>
Launch on a private receiving profile after hydrating an existing record in the same workspace. The production installer validates its identity before the app can initialize or open it.
Sourcepub fn with_window_records(documents: &mut [Doc]) -> Result<Self, LaunchError>
pub fn with_window_records(documents: &mut [Doc]) -> Result<Self, LaunchError>
A new window of the app on a fresh profile that already holds
documents, each a record a window of the app kept in the test workspace
(window_record): how an app that now keeps one record per workspace
first opens where it used to keep one per window.
Sourcepub fn with_workspace_record(document: &mut Doc) -> Result<Self, LaunchError>
pub fn with_workspace_record(document: &mut Doc) -> Result<Self, LaunchError>
A new window of an app that keeps one record per workspace
on a fresh profile whose workspace record is already document: how a
workspace an earlier version of the app wrote opens.
Sourcepub fn handed_off(
arguments: &[&str],
handoff: PlaybackHandoff,
) -> Result<Self, LaunchError>
pub fn handed_off( arguments: &[&str], handoff: PlaybackHandoff, ) -> Result<Self, LaunchError>
The app launched with arguments to continue handoff’s playback,
as the session launches the target of a media handoff.
Sourcepub fn handed(file: OpenFile) -> Result<Self, LaunchError>
pub fn handed(file: OpenFile) -> Result<Self, LaunchError>
Sourcepub fn replaying(file: OpenFile) -> Result<Self, LaunchError>
pub fn replaying(file: OpenFile) -> Result<Self, LaunchError>
The app replaying the recording file holds, as the session opens a
recording a report carries: in a private window of its own.
Sourcepub fn open_data_dir(directory: &Path) -> Result<Self, LaunchError>
pub fn open_data_dir(directory: &Path) -> Result<Self, LaunchError>
The app on the profile --data-dir directory opens, as its owner.
Only one writer may hold a profile: this fails while the app (or
another HeadlessApp) has it open.
Sourcepub fn files(&self) -> AppFiles
pub fn files(&self) -> AppFiles
The app’s file areas in this profile, which the running app writes instead of the person’s.
Sourcepub fn settings<T: SettingsSchema>(&self) -> Settings<T>
pub fn settings<T: SettingsSchema>(&self) -> Settings<T>
The app’s typed settings in this profile’s settings, which the running app follows: a write here is what another window, the Settings app or another of the person’s devices writing them does.
Sourcepub fn set_role(&mut self, role: Role)
pub fn set_role(&mut self, role: Role)
Change the participant’s role while the app runs, as the record’s owner changing their access does. Takes effect on the next frame, which this runs.
Sourcepub fn permissions(&self) -> PermissionContext
pub fn permissions(&self) -> PermissionContext
The participant’s permissions in force now.
Sourcepub fn set_permissions(&mut self, permissions: PermissionContext)
pub fn set_permissions(&mut self, permissions: PermissionContext)
Change the participant’s permissions while the app runs, as the host does when the workspace’s grants change. Takes effect on the next frame, which this runs.
Sourcepub fn leave_workspace(&mut self)
pub fn leave_workspace(&mut self)
Take the participant out of the workspace while the app runs: no role and no grant left, as when the owner removes them.
Sourcepub fn reopen(self) -> Result<Self, LaunchError>
pub fn reopen(self) -> Result<Self, LaunchError>
Close the app (flushing its record) and open it again on the same profile, as a relaunch would.
Sourcepub fn relaunch(self, arguments: &[&str]) -> Result<Self, LaunchError>
pub fn relaunch(self, arguments: &[&str]) -> Result<Self, LaunchError>
Close the app and launch it again on the same profile with
arguments, as app ARGUMENTS run again would.
Sourcepub fn another_window(self) -> Result<Self, LaunchError>
pub fn another_window(self) -> Result<Self, LaunchError>
Close the app and open a new window of it on the same profile and in the same workspace, as the launcher opens one: an instance it never had, whose fallback record is a fresh record of that window’s own unless the app keeps one per workspace.
Sourcepub fn open_window(&self) -> Result<Self, LaunchError>
pub fn open_window(&self) -> Result<Self, LaunchError>
Open another window of the app beside this one, on the same profile
and in the same workspace, while this one stays open: two windows a
person has open at once. Its fallback record is the workspace’s when the
app keeps one per workspace, so both show one
record; Self::deliver_changes_to carries edits between them.
Sourcepub fn deliver_changes_to(&mut self, other: &mut Self) -> Result<bool, String>
pub fn deliver_changes_to(&mut self, other: &mut Self) -> Result<bool, String>
Deliver this window’s changes to the record to other, a window
showing the same record, as the workspace’s broker fans each window’s
document changes out to every other window on the record; other
takes them in and draws its next frame, without reopening. Whether
other changed.
Sourcepub fn deliver_record_to(
&mut self,
other: &mut Self,
id: &RecordId,
) -> Result<bool, String>
pub fn deliver_record_to( &mut self, other: &mut Self, id: &RecordId, ) -> Result<bool, String>
Deliver what this window holds of id, a record the app keeps
beside its own (a part of a chain), to other, which holds it too,
as the workspace’s record sync sends a device a record it opened: other
takes it in and draws its next frame. Whether other changed.
Sourcepub fn workspace_answered(&mut self, id: RecordId)
pub fn workspace_answered(&mut self, id: RecordId)
The workspace’s hosts sent everything they hold of id, a record this
window asked for, or none is connected to ask
(ui_core::record::RecordStore::note_workspace_answered).
Sourcepub fn window_records(&self) -> Vec<(RecordId, Doc)>
pub fn window_records(&self) -> Vec<(RecordId, Doc)>
The workspace’s default records of the app’s windows kept on this
profile, as SeedCx::window_records
reads them.
Sourcepub fn open_here(&mut self, arguments: &[&str]) -> Result<(), String>
pub fn open_here(&mut self, arguments: &[&str]) -> Result<(), String>
Open what a launch naming arguments opens in this window, as the
app’s view does with RecordEnv::open_here,
and run the frame that shows it.
§Errors
Returns why the record cannot be opened: the window keeps the one it shows.
pub fn record(&self) -> &RecordId
Sourcepub fn take_save_retry(&mut self) -> Result<bool, String>
pub fn take_save_retry(&mut self) -> Result<bool, String>
Consume the hosted window’s explicit save-retry request, as its record owner does before reporting durability again.
Sourcepub fn flush(&mut self) -> Result<(), LaunchError>
pub fn flush(&mut self) -> Result<(), LaunchError>
Make every edit so far durable, as closing the app does.
Sourcepub fn surface_mut<S: 'static>(&mut self) -> &mut S
pub fn surface_mut<S: 'static>(&mut self) -> &mut S
The custom surface of type S the view hosts, without running a
frame: for a test reading it, or setting it up, between the events it
sends.
Sourcepub fn harness(&mut self) -> &mut FrameHarness
pub fn harness(&mut self) -> &mut FrameHarness
The headless frame harness, for input-level tests (click_named,
type_text, targets).
Sourcepub fn texts(&mut self) -> Vec<String>
pub fn texts(&mut self) -> Vec<String>
Every text the window shows now, as assistive technology reads it: what the app’s view drew of its state.
Sourcepub fn open_records(&self) -> Vec<RecordId>
pub fn open_records(&self) -> Vec<RecordId>
The records this window’s store has open: what the app process opened itself, which an app the session serves opens none of.
Sourcepub fn submit(&mut self, submit: impl Submit<A::Resource>) -> Result<(), String>
pub fn submit(&mut self, submit: impl Submit<A::Resource>) -> Result<(), String>
Submit submit through the running view’s own dispatcher, as a
control’s press or a field’s edit hands it over: over the session’s
connection when the app is the session’s, into the record here when
it is not.
Sourcepub fn with_surface<S: 'static, T>(
&mut self,
visit: impl FnOnce(&mut S) -> T,
) -> Option<T>
pub fn with_surface<S: 'static, T>( &mut self, visit: impl FnOnce(&mut S) -> T, ) -> Option<T>
Visit the custom surface of type S the app’s view hosts
(ViewCx::surface), as the frame shows it
now; None when the view hosts none. The frame is laid out again
after the visit, so what the visit changed is what the next frame
draws.
Sourcepub fn invoke(&mut self, invoke: Invoke<A::Resource>) -> Result<(), DoorError>
pub fn invoke(&mut self, invoke: Invoke<A::Resource>) -> Result<(), DoorError>
Invoke a declared action through the host door, exactly as a control, the palette, an agent or a script does.
Sourcepub fn invoke_child<C: Resource>(
&mut self,
resource: &str,
invoke: Invoke<C>,
) -> Result<(), DoorError>
pub fn invoke_child<C: Resource>( &mut self, resource: &str, invoke: Invoke<C>, ) -> Result<(), DoorError>
Invoke an action of the resource nested in this one at resource —
a child resource a view edits through Dispatcher::child
— through the host door, as the palette, an agent or a script
addresses it.
§Errors
As Self::invoke.
Sourcepub fn invoke_confirmed(
&mut self,
invoke: Invoke<A::Resource>,
) -> Result<(), DoorError>
pub fn invoke_confirmed( &mut self, invoke: Invoke<A::Resource>, ) -> Result<(), DoorError>
Self::invoke after the caller confirmed it, as the host’s
confirmation prompt does for a destructive action.
§Errors
As Self::invoke, except that no confirmation is required.
Sourcepub fn actions(&mut self) -> Result<Vec<ActionDescriptor>, DoorError>
pub fn actions(&mut self) -> Result<Vec<ActionDescriptor>, DoorError>
Discover the actions this participant may invoke on the running app, including item and child resources. Descriptors include the complete parameter, permission, confirmation and result contracts; discovery never invokes an action. Addresses stay stable across relayouts.
A saved descriptor is not an authority grant: every call checks the running app’s current permissions and resource state again.
Sourcepub fn agent_surface(&mut self) -> Value
pub fn agent_surface(&mut self) -> Value
What an agent sees of the running app: every published action with its address, label, description and typed parameters, in a stable order. Snapshot it so a change shows how it altered the vocabulary an agent, a script or a screen reader works with, and what it costs in context.
Sourcepub fn operate(
&mut self,
invoke: Invoke<A::Resource>,
) -> Result<Option<ActionOutput>, DoorError>
pub fn operate( &mut self, invoke: Invoke<A::Resource>, ) -> Result<Option<ActionOutput>, DoorError>
Run a view or effect operation (look, export) through the host
door, as an agent or script does, and answer with what it produced;
None while it is still running.
§Errors
As Self::invoke.
Sourcepub fn effect<E: Effect>(
&mut self,
effect: &E,
) -> Result<ActionOutput, DoorError>
pub fn effect<E: Effect>( &mut self, effect: &E, ) -> Result<ActionOutput, DoorError>
Invoke one of the app’s effects through the host door, as a button,
the palette or an agent does, and wait for its answer: what it
reported at once, or the result of the job it started. Progress the
job reported is in FrameHarness::job_updates.
Sourcepub fn effect_by<E: Effect>(
&mut self,
actor: &str,
effect: &E,
) -> Result<ActionOutput, DoorError>
pub fn effect_by<E: Effect>( &mut self, actor: &str, effect: &E, ) -> Result<ActionOutput, DoorError>
Self::effect invoked by actor — an agent or a collaborator the
host admitted for the effect — rather than the person at this
device: what the effect submits is applied as theirs, and only as
far as the effect they were admitted for allows.
§Errors
As Self::effect; the refusal of an edit the effect submitted
fails it.
Sourcepub fn call_by(
&mut self,
invoker: ActionInvoker,
resource: &str,
id: &str,
arguments: Value,
) -> Result<ActionOutput, DoorError>
pub fn call_by( &mut self, invoker: ActionInvoker, resource: &str, id: &str, arguments: Value, ) -> Result<ActionOutput, DoorError>
Any published action of resource, by id with JSON arguments,
delivered for invoker as the host delivers an admitted execution’s
invocation: what it builds is bound to the invoker’s own participant
view, and what it submits is applied as theirs.
§Errors
As Self::effect.
Sourcepub fn effect_confirmed<E: Effect>(
&mut self,
effect: &E,
) -> Result<ActionOutput, DoorError>
pub fn effect_confirmed<E: Effect>( &mut self, effect: &E, ) -> Result<ActionOutput, DoorError>
Self::effect after the caller confirmed it, as the host’s
confirmation prompt does for a destructive effect.
§Errors
As Self::effect.
Sourcepub fn effect_on<E: Effect>(
&mut self,
row: &str,
effect: &E,
) -> Result<ActionOutput, DoorError>
pub fn effect_on<E: Effect>( &mut self, row: &str, effect: &E, ) -> Result<ActionOutput, DoorError>
Self::effect as the published child or live row row offers it,
bound to its arguments (Effect::bound): the caller names only the
row and the effect, as the palette or an agent does on an item.
§Errors
As Self::effect.
Sourcepub fn effect_on_confirmed<E: Effect>(
&mut self,
row: &str,
effect: &E,
) -> Result<ActionOutput, DoorError>
pub fn effect_on_confirmed<E: Effect>( &mut self, row: &str, effect: &E, ) -> Result<ActionOutput, DoorError>
Sourcepub fn start_effect<E: Effect>(
&mut self,
effect: &E,
) -> Result<InvocationId, DoorError>
pub fn start_effect<E: Effect>( &mut self, effect: &E, ) -> Result<InvocationId, DoorError>
Start effect through the host door without waiting for it, as a
caller that may cancel it does, confirmed: the invocation its job
runs under.
§Errors
The host’s refusal, the effect’s failure, or that it answered at once and so started no job.
Sourcepub fn start_effect_on<E: Effect>(
&mut self,
row: &str,
effect: &E,
) -> Result<InvocationId, DoorError>
pub fn start_effect_on<E: Effect>( &mut self, row: &str, effect: &E, ) -> Result<InvocationId, DoorError>
Self::start_effect as the published child or live row row
offers it, bound to its arguments.
§Errors
Sourcepub fn cancel_effect(
&mut self,
invocation: InvocationId,
) -> Option<InvocationUpdate>
pub fn cancel_effect( &mut self, invocation: InvocationId, ) -> Option<InvocationUpdate>
Cancel the job of an effect Self::start_effect started, as its
caller does: what it ended as, Cancelled when it stopped. None
when it already finished.
Sourcepub fn effect_progress(&mut self) -> Vec<InvocationUpdate>
pub fn effect_progress(&mut self) -> Vec<InvocationUpdate>
What the job of the last Self::effect reported, in order: its
progress, then its result.
Sourcepub fn with_widget<T: 'static, O>(
&mut self,
visit: impl FnOnce(&mut T) -> O,
) -> Option<O>
pub fn with_widget<T: 'static, O>( &mut self, visit: impl FnOnce(&mut T) -> O, ) -> Option<O>
Run visit on the app’s widget of type T — a custom surface, a
widget its view built — for assertions about view state the
accessibility tree does not show, then run the frame after it.
None when the view has no such widget.
Sourcepub fn search_index_entries(&mut self) -> Vec<IndexEntry>
pub fn search_index_entries(&mut self) -> Vec<IndexEntry>
What the system’s persistent search index keeps of this window now: the entries the app publishes to it, found after it closes too.
Sourcepub fn refused(&mut self) -> Option<Refused>
pub fn refused(&mut self) -> Option<Refused>
The last action refused here (super::Dispatcher::refused): by
the door, or by the workspace after this window applied it.
Sourcepub fn refused_by_workspace(
&mut self,
changes: &[[u8; 32]],
reason: &str,
) -> Result<bool, String>
pub fn refused_by_workspace( &mut self, changes: &[[u8; 32]], reason: &str, ) -> Result<bool, String>
The workspace refused changes (Automerge hashes) of this window’s
record, reason what a person is told (a host replicating the
record reads it from the workspace’s words with
tilo_relay_protocol::refusal::plain_reason): withdraw them and what
was built on them, as that host does, and run the frame that tells
the app. Whether anything was withdrawn.
Sourcepub fn said(&mut self) -> Option<String>
pub fn said(&mut self) -> Option<String>
What the workspace kept that the app said it did
(super::Dispatcher::say_when_kept): the last such text.
From now on a host replicates this window’s record to a workspace that
decides its changes, as a browser page in a workspace does: what the app
says it did waits for the workspace (Self::workspace_publishes,
Self::workspace_keeps).
Sourcepub fn workspace_publishes(&mut self) -> Result<bool, String>
pub fn workspace_publishes(&mut self) -> Result<bool, String>
The host publishes what changed since it last did, as its next pass does; whether anything was published.
Sourcepub fn workspace_keeps(&mut self)
pub fn workspace_keeps(&mut self)
The workspace answered every commit the host published, keeping them, and the frame that tells the app runs.
Sourcepub fn settle(&mut self)
pub fn settle(&mut self)
Run the frame the app runs after an event: edits the views and effects submitted are applied, and what they change is drawn.
Sourcepub fn idle(&mut self)
pub fn idle(&mut self)
What the live window does once input stops, and no more: what its
components’ workers woke them for taken up, the frame the input
asked for, control invocations dispatched and edits offered to the
record’s writer (FrameHarness::idle). Unlike Self::settle it
forces no frame to sync and publish, so it costs what the live window
costs: what the perf measurements run after each interaction.
Sourcepub fn frame(&mut self) -> bool
pub fn frame(&mut self) -> bool
One frame of the live window, when it asks for one: what its components’ workers woke them for taken up, as the window’s frame takes it, then the frame a redraw, an animation or a due deadline asks for. Whether a frame ran.
Sourcepub fn call(
&mut self,
id: &str,
arguments: Value,
) -> Result<Option<Value>, DoorError>
pub fn call( &mut self, id: &str, arguments: Value, ) -> Result<Option<Value>, DoorError>
Invoke any published action of the resource by id with JSON
arguments, as an agent’s tilo_invoke does — the framework’s own
(undo, history, render) as well as the app’s — and answer with
what it reported.
§Errors
As Self::invoke.
Sourcepub fn call_in_run(
&mut self,
run: &str,
id: &str,
arguments: Value,
) -> Result<Option<Value>, DoorError>
pub fn call_in_run( &mut self, run: &str, id: &str, arguments: Value, ) -> Result<Option<Value>, DoorError>
Self::call as one agent run: every call naming the same run
belongs to it, the way an agent’s connection groups its invocations.
§Errors
As Self::invoke.
Sourcepub fn call_on(
&mut self,
resource: &str,
id: &str,
arguments: Value,
) -> Result<Option<Value>, DoorError>
pub fn call_on( &mut self, resource: &str, id: &str, arguments: Value, ) -> Result<Option<Value>, DoorError>
Self::call on another published resource than the app’s own: a
child, an item, or a live row a surface shows ("job:7"), addressed
by its id.
§Errors
As Self::invoke.
Sourcepub fn call_on_finished(
&mut self,
resource: &str,
id: &str,
arguments: Value,
) -> Result<ActionOutput, DoorError>
pub fn call_on_finished( &mut self, resource: &str, id: &str, arguments: Value, ) -> Result<ActionOutput, DoorError>
Self::call_on, waiting for the job the action started, as
Self::effect does: what it finished with.
§Errors
As Self::effect.
Sourcepub fn call_on_output(
&mut self,
resource: &str,
id: &str,
arguments: Value,
) -> Result<Option<ActionOutput>, DoorError>
pub fn call_on_output( &mut self, resource: &str, id: &str, arguments: Value, ) -> Result<Option<ActionOutput>, DoorError>
Self::call_on, answering the whole output: the value and the
resources the call produced, such as the items a verb created.
§Errors
As Self::invoke.
Sourcepub fn asking(&mut self) -> Option<(ActionAddress, String)>
pub fn asking(&mut self) -> Option<(ActionAddress, String)>
What the host is asking the person to confirm right now — a
destructive verb or a removal that a button, a menu, the palette or
an immediate application submitted — and the question it asks.
None while nothing is asked.
Sourcepub fn confirm_asked(&mut self) -> Option<ActionAddress>
pub fn confirm_asked(&mut self) -> Option<ActionAddress>
Confirm what the host asks, through its real dialog, as the person
does (Enter on its question), and settle: the
action applies. Answers the action confirmed; None, changing
nothing, when nothing was asked. A test of a delete from a menu
clicks the menu item, then calls this.
Sourcepub fn call_confirmed(
&mut self,
id: &str,
arguments: Value,
) -> Result<Option<Value>, DoorError>
pub fn call_confirmed( &mut self, id: &str, arguments: Value, ) -> Result<Option<Value>, DoorError>
Self::call after the caller explicitly confirmed this invocation.
Argument validation and current permissions are still enforced.
§Errors
As Self::call, except that no confirmation is required.
Sourcepub fn call_confirmed_on(
&mut self,
resource: &str,
id: &str,
arguments: Value,
) -> Result<Option<Value>, DoorError>
pub fn call_confirmed_on( &mut self, resource: &str, id: &str, arguments: Value, ) -> Result<Option<Value>, DoorError>
Self::call_on after the caller explicitly confirmed this invocation
on an item or child resource. Use the address returned by
Self::actions; no item id needs to be guessed or parsed from a label.
Confirmation applies to this call only and grants no authority.
§Errors
As Self::call_on, except that no confirmation is required.
pub fn state(&self) -> <A::Resource as Resource>::State
Sourcepub fn read_document<T>(&self, read: impl FnOnce(&Doc) -> T) -> T
pub fn read_document<T>(&self, read: impl FnOnce(&Doc) -> T) -> T
Read the stored document itself — the parts of a large resource its state does not hold until a view demands them.
Sourcepub fn peer_document(&self) -> Doc
pub fn peer_document(&self) -> Doc
A copy of the stored document written by another participant: a
collaborator’s replica, for a test to edit and Self::merge_peer
back.
Sourcepub fn merge_peer(&mut self, peer: &mut Doc) -> Result<(), String>
pub fn merge_peer(&mut self, peer: &mut Doc) -> Result<(), String>
Exchange edits with a collaborator’s replica, as sync does both ways:
the peer’s edits arrive in the running app (and its views), and the
app’s edits arrive in peer.
Sourcepub fn replica_arrives(
&mut self,
record: &RecordId,
edit: impl FnOnce(&mut Doc),
) -> Result<bool, String>
pub fn replica_arrives( &mut self, record: &RecordId, edit: impl FnOnce(&mut Doc), ) -> Result<bool, String>
Another replica’s change to record, a record open in the app’s
store (its own, or a part of a chain beside it), arriving as a workspace’s
replication delivers it: edit writes on that replica as it stands
now, under its own actor, and the change is merged into the store.
Nothing else runs: no frame is laid out or forced, so what the window
shows of it is what its own frames (Self::frame) take up, as for
a person who is only watching. Whether the record changed.
Sourcepub fn history(&self) -> Vec<ActionContext>
pub fn history(&self) -> Vec<ActionContext>
What each version did through an action, oldest first.
Sourcepub fn sentences<'e>(
&self,
entries: impl IntoIterator<Item = &'e ActionContext>,
) -> Vec<String>
pub fn sentences<'e>( &self, entries: impl IntoIterator<Item = &'e ActionContext>, ) -> Vec<String>
The sentences History shows for entries in en-US, through the app’s
own catalogue.
Sourcepub fn past_version(
&self,
heads: &[ChangeHash],
) -> Result<PastVersion<A::Resource>, String>
pub fn past_version( &self, heads: &[ChangeHash], ) -> Result<PastVersion<A::Resource>, String>
The version at heads as History mode previews it: the app’s own
view, read-only, over the document as it was then.
Sourcepub fn merge_peer_edit(&mut self, edit: impl FnOnce(&mut Doc))
pub fn merge_peer_edit(&mut self, edit: impl FnOnce(&mut Doc))
A collaborator’s edit arriving: edit writes on their own replica of
the record as it stands now, under their own actor, and the change is
merged in as sync merges a peer’s. It is not the local participant’s
action, so it never lands on their undo stack.
Trait Implementations§
Source§impl<A: ResourceApp> Drop for HeadlessApp<A>
impl<A: ResourceApp> Drop for HeadlessApp<A>
Auto Trait Implementations§
impl<A> !Freeze for HeadlessApp<A>
impl<A> !RefUnwindSafe for HeadlessApp<A>
impl<A> !Send for HeadlessApp<A>
impl<A> !Sync for HeadlessApp<A>
impl<A> Unpin for HeadlessApp<A>where
A: Unpin,
impl<A> UnsafeUnpin for HeadlessApp<A>
impl<A> !UnwindSafe for HeadlessApp<A>
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