pub struct ActionContext {Show 19 fields
pub app: Option<ActionApp>,
pub resource: Option<ActionResource>,
pub item: Option<ActionItem>,
pub what: Option<Did>,
pub kind: Option<ActionKind>,
pub purpose: Option<String>,
pub group: Option<WorkGroup>,
pub facets: Vec<ActionFacet>,
pub invoker: Option<ActionInvoker>,
pub source_invocation: Option<InvocationId>,
pub signed: Option<Box<SignedCall>>,
pub caused_by: Option<Cause>,
pub action: Option<EncodedAction>,
pub compensation: Option<EncodedAction>,
pub gesture: Option<ActionId>,
pub change: ChangeKind,
pub shows: Vec<Fact>,
pub approval: Option<Approval>,
pub pressed: bool,
}Fields§
§app: Option<ActionApp>Publishing app, when the host knows it.
resource: Option<ActionResource>§item: Option<ActionItem>The item inside the resource the action addressed, with its label at the time.
what: Option<Did>What the action did, described by the action before it applied.
kind: Option<ActionKind>What the action is able to do (read, change the document, reach outside it). Written by the executor from the action.
purpose: Option<String>What the actor says they are trying to accomplish. Never inferred.
group: Option<WorkGroup>Stable cross-action work unit: issue, agent run, task, or session.
facets: Vec<ActionFacet>Browseable dimensions that do not fit the resource hierarchy.
invoker: Option<ActionInvoker>Who invoked the action, for whom, and whose view it resolves
against. None is the local person acting in this window.
source_invocation: Option<InvocationId>The invocation admitted by the action API, when this change came through one. This is correlation, not authority: executors replace this field from their retained admission before applying an action.
signed: Option<Box<SignedCall>>The invocation as its caller signed it, when a host ran the action for
someone who asked it under their own key: the host signs the change as
the one who ran it, and this says who asked, for what, with what
arguments. A peer reading the change checks it against the person’s
root (crate::remote::SignedCall); the host never makes one up.
caused_by: Option<Cause>The bot run that made this change, when one did.
action: Option<EncodedAction>The action this change ran, encoded as the executor dispatched it:
what a device that receives the change replays to verify it, and
what redo runs again. The executor records it on every change it
commits whose action the change documents whole
(WHOLE_ACTION_BUDGET); a larger one records its large parts as
content (crate::content) and names them, and one too large even
then (HISTORY_BUDGET) is refused. It describes the change; it
carries no caller authority.
compensation: Option<EncodedAction>The inverse of action at its before state, as the
canonical executor computed it, for an action whose undo is an action
(it queued an outside consequence). Absent for one undone by
reverting the change. Carries no caller authority.
gesture: Option<ActionId>The gesture this change belongs to: an id every change of one actor’s gesture shares (the keystrokes of a word, the values one drag of a slider passes through), which undo takes back as one step. Absent for a change that is a step of its own.
change: ChangeKindWhat the change is to the people sharing the document, declared by
the action (crate::Action::change_kind) or, for a change that is
nobody’s step whatever it does (what a brand-new record starts with),
by the context it is applied with.
shows: Vec<Fact>The facts an ask shows, as the calling runtime evaluated them, when caller and callee are one app: values only that app can read (a draft’s subject). Taken only from that app’s own call; any other caller’s are ignored and admission reads them from the arguments.
approval: Option<Approval>The person’s approve of the asked record this invocation waited in, when it is that
call sent again (crate::remote::InvokeRequest::approval): what an app’s handler
reads to run what it refused for want of their yes. Set only by the host that
admitted the invocation, from the call itself, never from a caller’s context.
pressed: boolThe person made this invocation themselves, with a press the compositor attested to the system’s own surfaces (a palette’s row, a menu’s item, a shortcut’s key): what an app’s handler runs as their own act, so what its code calls of its own does not ask them again. Set only by the host that admitted the invocation, from the attestation it holds, never from a caller’s context.
Implementations§
Source§impl ActionContext
impl ActionContext
pub fn serialize<__S>(
__self: &ActionContext,
__serializer: __S,
) -> Result<__S::Ok, __S::Error>where
__S: Serializer,
Source§impl<'de> ActionContextwhere
ActionContext: Default,
impl<'de> ActionContextwhere
ActionContext: Default,
pub fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActionContext, __D::Error>where
__D: Deserializer<'de>,
Source§impl ActionContext
impl ActionContext
Sourcepub fn enriched_by(self, ambient: &Self) -> Self
pub fn enriched_by(self, ambient: &Self) -> Self
Fill missing provenance from a task/session context while preserving every value supplied by the concrete action/resource.
Sourcepub fn with_source_invocation(self, invocation: Option<InvocationId>) -> Self
pub fn with_source_invocation(self, invocation: Option<InvocationId>) -> Self
Pin the invocation retained by the admitted dispatch boundary.
This replaces rather than fills an ambient value. Only the executor that owns admission should call it.
Sourcepub fn with_caused_by(self, cause: Option<Cause>) -> Self
pub fn with_caused_by(self, cause: Option<Cause>) -> Self
Record the bot run this change continues.
pub fn for_resource( id: impl Into<String>, kind: impl Into<String>, label: impl Into<String>, ) -> Self
Sourcepub fn for_app(id: impl Into<String>, label: impl Into<String>) -> Self
pub fn for_app(id: impl Into<String>, label: impl Into<String>) -> Self
The entry of an action published by one app.
pub fn with_app(self, id: impl Into<String>, label: impl Into<String>) -> Self
pub fn with_purpose(self, purpose: impl Into<String>) -> Self
pub fn with_group( self, id: impl Into<String>, label: impl Into<String>, kind: impl Into<String>, ) -> Self
pub fn with_invoker(self, invoker: ActionInvoker) -> Self
Sourcepub fn with_host_actor(
self,
actor: &Acting,
presence: Option<PresenceId>,
) -> Self
pub fn with_host_actor( self, actor: &Acting, presence: Option<PresenceId>, ) -> Self
Host-side rewrite of a caller-supplied context: the invoker becomes
exactly the authenticated actor and the host-derived presence,
discarding whatever invoker the caller put in the envelope.
pub fn with_facet(self, facet: ActionFacet) -> Self
Sourcepub fn in_step(self) -> Self
pub fn in_step(self) -> Self
Join the undo step open on this thread
(crate::executor::open_step) unless the entry names one.
Sourcepub fn in_gesture(self, gesture: Option<ActionId>) -> Self
pub fn in_gesture(self, gesture: Option<ActionId>) -> Self
Continue the gesture gesture (see Self::gesture).
pub fn with_change(self, change: ChangeKind) -> Self
Sourcepub fn with_described(self, described: Described) -> Self
pub fn with_described(self, described: Described) -> Self
Record what the action did and the item it addressed.
Sourcepub fn described(&self) -> Option<Described>
pub fn described(&self) -> Option<Described>
What the action did and to which item, as one value.
Sourcepub fn is_housekeeping(&self) -> bool
pub fn is_housekeeping(&self) -> bool
Whether the change this context describes is housekeeping, not content.
Sourcepub fn is_activity(&self) -> bool
pub fn is_activity(&self) -> bool
Whether workspace activity shows this change: content, not housekeeping and not what came from outside.
Sourcepub fn whole_edit_by(acting: &Acting) -> String
pub fn whole_edit_by(acting: &Acting) -> String
The message of a change acting made to a record directly, naming no finer action than
an edit of the whole record: what a device commits of its own edit, naming who made it as
every change a device signs must. Every receiver decides it as acting’s, never as its
signer’s alone.
Sourcepub fn change_message(&self) -> Option<String>
pub fn change_message(&self) -> Option<String>
Encode into the Automerge change message. Returning None keeps an
empty/default context from displacing an app’s ordinary history path.
Sourcepub fn from_change_message(message: &str) -> Option<Self>
pub fn from_change_message(message: &str) -> Option<Self>
Read an entry from a change message, through the one reader of change labels
(Stamp::read). Unknown and malformed messages are ordinary
app commits, never an error that hides their history. A continuation is no entry on its
own: read it with continued from its writer’s last whole entry. A
store’s change names its action in a stamp: its context, and what the stamp itself says
of who invoked it and for which step.
Sourcepub fn head_of_change_message(message: &str) -> Option<Self>
pub fn head_of_change_message(message: &str) -> Option<Self>
Read only what an entry says about who made its change, in which run
and step, and what kind of change it is (its group, invoker, invocation,
gesture, kind and change kind; everything else left default): what an index
over a long history keeps of every change, read without decoding
what the change did. None where from_change_message
reads no entry.
Sourcepub fn continuation_of(&self, first: &Self) -> Option<String>
pub fn continuation_of(&self, first: &Self) -> Option<String>
This entry, written as the continuation of first (its writer’s
last whole entry): when it is in a gesture and differs from first
only in its gesture and its action’s payload. None when it has to
be written whole.
Sourcepub fn continued_gesture(message: &str) -> Option<ActionId>
pub fn continued_gesture(message: &str) -> Option<ActionId>
The gesture a continuation message continues.
Trait Implementations§
Source§impl Clone for ActionContext
impl Clone for ActionContext
Source§impl Debug for ActionContext
impl Debug for ActionContext
Source§impl Default for ActionContext
impl Default for ActionContext
Source§impl<'de> Deserialize<'de> for ActionContext
impl<'de> Deserialize<'de> for ActionContext
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for ActionContext
Source§impl PartialEq for ActionContext
impl PartialEq for ActionContext
Source§impl Serialize for ActionContext
impl Serialize for ActionContext
impl StructuralPartialEq for ActionContext
Auto Trait Implementations§
impl Forget for ActionContext
impl Freeze for ActionContext
impl Move for ActionContext
impl RefUnwindSafe for ActionContext
impl Send for ActionContext
impl Sync for ActionContext
impl Unpin for ActionContext
impl UnsafeUnpin for ActionContext
impl UnwindSafe for ActionContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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