Skip to main content

ActionContext

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: ChangeKind

What 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

pub fn serialize<__S>( __self: &ActionContext, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

§

impl<'de> ActionContext

pub fn deserialize<__D>( __deserializer: __D, ) -> Result<ActionContext, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

§

impl 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

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

Record the bot run this change continues.

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

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

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

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

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

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

Continue the gesture gesture (see Self::gesture).

pub fn with_change(self, change: ChangeKind) -> ActionContext

pub fn with_described(self, described: Described) -> ActionContext

Record what the action did and the item it addressed.

pub fn described(&self) -> Option<Described>

What the action did and to which item, as one value.

pub fn is_housekeeping(&self) -> bool

Whether the change this context describes is housekeeping, not content.

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

The actor’s kind; the local person when nobody else is recorded.

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>

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>

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>

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>

The gesture a continuation message continues.

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

§

fn clone(&self) -> ActionContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for ActionContext

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for ActionContext

§

fn default() -> ActionContext

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for ActionContext

§

fn deserialize<D>( deserializer: D, ) -> Result<ActionContext, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl PartialEq for ActionContext

§

fn eq(&self, other: &ActionContext) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for ActionContext

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for ActionContext

§

impl StructuralPartialEq for ActionContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

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

§

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

§

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,