Struct ActionContext
pub struct ActionContext {Show 15 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<ActionGroup>,
pub facets: Vec<ActionFacet>,
pub invoker: Option<ActionInvoker>,
pub source_invocation: Option<InvocationId>,
pub caused_by: Option<Cause>,
pub action: Option<EncodedAction>,
pub compensation: Option<EncodedAction>,
pub gesture: Option<ActionId>,
pub change: ChangeKind,
}Fields§
§app: Option<ActionApp>Publishing app, when the host knows it.
resource: Option<ActionResource>The resource the action addressed.
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<ActionGroup>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 door, when this change came through one. This is correlation, not authority: executors replace this field from their retained admission before applying an action.
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 fits HISTORY_BUDGET; a larger one (content
carried inline instead of as a blob) commits without it. 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.
Implementations§
§impl ActionContext
impl ActionContext
pub fn serialize<__S>(
__self: &ActionContext,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl<'de> ActionContextwhere
ActionContext: Default,
impl<'de> ActionContextwhere
ActionContext: Default,
pub fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActionContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl ActionContext
impl ActionContext
pub fn enriched_by(self, ambient: &ActionContext) -> ActionContext
pub fn enriched_by(self, ambient: &ActionContext) -> ActionContext
Fill missing provenance from a task/session context while preserving every value supplied by the concrete action/resource.
pub fn with_source_invocation(
self,
invocation: Option<InvocationId>,
) -> ActionContext
pub fn with_source_invocation( self, invocation: Option<InvocationId>, ) -> ActionContext
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.
pub fn with_caused_by(self, cause: Option<Cause>) -> ActionContext
pub fn with_caused_by(self, cause: Option<Cause>) -> ActionContext
Record the bot run this change continues.
pub fn for_resource(
id: impl Into<String>,
kind: impl Into<String>,
label: impl Into<String>,
) -> ActionContext
pub fn for_resource( id: impl Into<String>, kind: impl Into<String>, label: impl Into<String>, ) -> ActionContext
The entry of an action on one resource.
pub fn for_app(id: impl Into<String>, label: impl Into<String>) -> ActionContext
pub fn for_app(id: impl Into<String>, label: impl Into<String>) -> ActionContext
The entry of an action published by one app.
pub fn with_app( self, id: impl Into<String>, label: impl Into<String>, ) -> ActionContext
pub fn with_inferred_app(self, type_id: &str) -> ActionContext
pub fn with_inferred_app(self, type_id: &str) -> ActionContext
Fill app ownership from the registered action type when a generic
palette/door caller has only resource metadata. Explicit app context
always wins. Action types conventionally start with the package stem
(word-processor.action, api_tester.action).
pub fn with_purpose(self, purpose: impl Into<String>) -> ActionContext
pub fn with_group( self, id: impl Into<String>, label: impl Into<String>, kind: impl Into<String>, ) -> ActionContext
pub fn with_invoker(self, invoker: ActionInvoker) -> ActionContext
pub fn with_host_invoker(
self,
actor: impl Into<String>,
participant: Option<ParticipantId>,
) -> ActionContext
pub fn with_host_invoker( self, actor: impl Into<String>, participant: Option<ParticipantId>, ) -> ActionContext
Host-side rewrite of a caller-supplied context: the invoker becomes
exactly the authenticated person actor and the host-derived
participant, discarding whatever invoker the caller put in the
envelope.
pub fn with_host_actor(
self,
actor: &InteractionActor,
participant: Option<ParticipantId>,
) -> ActionContext
pub fn with_host_actor( self, actor: &InteractionActor, participant: Option<ParticipantId>, ) -> ActionContext
Self::with_host_invoker for any admitted actor: an agent, a
Shortcut or an app, with the person it acts for.
pub fn with_facet(self, facet: ActionFacet) -> ActionContext
pub fn in_step(self) -> ActionContext
pub fn in_step(self) -> ActionContext
Join the undo step open on this thread
(crate::executor::open_step) unless the entry names one.
pub fn in_gesture(self, gesture: Option<ActionId>) -> ActionContext
pub fn in_gesture(self, gesture: Option<ActionId>) -> ActionContext
Continue the gesture gesture (see Self::gesture).
pub fn with_change(self, change: ChangeKind) -> ActionContext
pub fn with_described(self, described: Described) -> ActionContext
pub fn with_described(self, described: Described) -> ActionContext
Record what the action did and the item it addressed.
pub fn is_housekeeping(&self) -> bool
pub fn is_housekeeping(&self) -> bool
Whether the change this context describes is housekeeping, not content.
pub 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.
pub fn actor_kind(&self) -> ActorKind
pub fn actor_kind(&self) -> ActorKind
The actor’s kind; the local person when nobody else is recorded.
pub 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.
pub fn from_change_message(message: &str) -> Option<ActionContext>
pub fn from_change_message(message: &str) -> Option<ActionContext>
Read an entry from a change message. 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 gesture’s first entry.
pub fn head_of_change_message(message: &str) -> Option<ActionContext>
pub fn head_of_change_message(message: &str) -> Option<ActionContext>
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, 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.
pub fn continuation_of(&self, first: &ActionContext) -> Option<String>
pub fn continuation_of(&self, first: &ActionContext) -> Option<String>
This entry, written as the continuation of first (its writer’s
previous entry): when it is the same step of the same gesture,
differing only in its action’s payload. None when it has to be
written whole.
pub fn continued_gesture(message: &str) -> Option<ActionId>
pub fn continued_gesture(message: &str) -> Option<ActionId>
The gesture a continuation message continues.
pub fn continued(message: &str, first: &ActionContext) -> Option<ActionContext>
pub fn continued(message: &str, first: &ActionContext) -> Option<ActionContext>
The entry a continuation message stands for, from its gesture’s
first entry first.
Trait Implementations§
§impl Clone for ActionContext
impl Clone for ActionContext
§fn clone(&self) -> ActionContext
fn clone(&self) -> ActionContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ActionContext
impl Debug for ActionContext
§impl Default for ActionContext
impl Default for ActionContext
§fn default() -> ActionContext
fn default() -> ActionContext
§impl<'de> Deserialize<'de> for ActionContext
impl<'de> Deserialize<'de> for ActionContext
§fn deserialize<D>(
deserializer: D,
) -> Result<ActionContext, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ActionContext, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl PartialEq for ActionContext
impl PartialEq for ActionContext
§impl Serialize for ActionContext
impl Serialize for ActionContext
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Eq for ActionContext
impl StructuralPartialEq for ActionContext
Auto Trait Implementations§
impl Freeze 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§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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> 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> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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