Skip to main content

ActionContext

Struct ActionContext 

Source
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: 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.

§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: bool

The 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

Source

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

Source§

impl<'de> ActionContext

Source

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

Source§

impl ActionContext

Source

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.

Source

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.

Source

pub fn with_caused_by(self, cause: Option<Cause>) -> Self

Record the bot run this change continues.

Source

pub fn for_resource( id: impl Into<String>, kind: impl Into<String>, label: impl Into<String>, ) -> Self

Source

pub fn for_app(id: impl Into<String>, label: impl Into<String>) -> Self

The entry of an action published by one app.

Source

pub fn with_app(self, id: impl Into<String>, label: impl Into<String>) -> Self

Source

pub fn with_purpose(self, purpose: impl Into<String>) -> Self

Source

pub fn with_group( self, id: impl Into<String>, label: impl Into<String>, kind: impl Into<String>, ) -> Self

Source

pub fn with_invoker(self, invoker: ActionInvoker) -> Self

Source

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.

Source

pub fn with_facet(self, facet: ActionFacet) -> Self

Source

pub fn in_step(self) -> Self

Join the undo step open on this thread (crate::executor::open_step) unless the entry names one.

Source

pub fn in_gesture(self, gesture: Option<ActionId>) -> Self

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

Source

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

Source

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

Record what the action did and the item it addressed.

Source

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

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

Source

pub fn is_housekeeping(&self) -> bool

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

Source

pub fn is_activity(&self) -> bool

Whether workspace activity shows this change: content, not housekeeping and not what came from outside.

Source

pub fn acting(&self) -> Option<&Acting>

Who invoked the action, when the context names anyone.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn continued_gesture(message: &str) -> Option<ActionId>

The gesture a continuation message continues.

Source

pub fn continued(message: &str, first: &Self) -> Option<Self>

The entry a continuation message stands for, from its writer’s last whole entry first.

Trait Implementations§

Source§

impl Clone for ActionContext

Source§

fn clone(&self) -> Self

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

impl Debug for ActionContext

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ActionContext

Source§

fn default() -> Self

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

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

Source§

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

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

impl Eq for ActionContext

Source§

impl PartialEq for ActionContext

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for ActionContext

Source§

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

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

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

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more