Skip to main content

DeclaredCommandAction

Struct DeclaredCommandAction 

Source
pub struct DeclaredCommandAction { /* private fields */ }
Expand description

A declared command, ready to run as an activity.

Implementations§

Source§

impl DeclaredCommandAction

Source

pub const fn new(contract: DeclaredCommandContract) -> Self

Wrap an emitted command.

Source

pub fn declared_working_directory(&self) -> Option<&str>

The working directory the DECLARATION states, verbatim.

Returned unexpanded because a {workspace_root} placeholder resolves against the executing host’s own workspace, which this crate has no business knowing. A caller reads this, resolves it however its host resolves roots, and hands the answer back through Self::with_working_directory.

Source

pub fn with_working_directory(self, directory: impl Into<PathBuf>) -> Self

Run the command in directory.

Source

pub fn declared_timeout(&self) -> Result<Option<Duration>, ActivityFailure>

The timeout the declaration states, if it states one.

Ok(None) means the declaration stated NONE, which is a legal declared state: nothing here substitutes a ceiling.

§Errors

Returns a terminal ActivityFailure when the contract carries a millisecond count no duration can hold — a negative one, say. The AWL checker refuses those before deploy, so reaching this arm means a defective contract was deployed; it is REFUSED rather than treated as “no ceiling”, because the direction of that failure is a command running unbounded on the operator’s machine while the declaration, the --check report and the named owner all say a bound was set.

Source

pub fn timeout_owner(&self) -> Option<&str>

Who owns the declared timeout, when there is one.

Source

pub fn name(&self) -> &str

The command’s declared name, for a diagnostic.

Source

pub fn render( &self, arguments: &BTreeMap<String, Value>, ) -> Result<RenderedCommand, ActivityFailure>

Render this command against arguments.

arguments is the ACTION’s whole input and may name parameters the command does not use — an action is free to declare more than one of its bodies needs. The command’s own declared names select from it, so a surplus is not a refusal here; a command parameter the action cannot supply is refused at check time, before anything is deployed.

§Errors

Returns a terminal ActivityFailure when a value has no unambiguous argument form, when a declared parameter has neither a supplied value nor a default, or when an operand would carry leading-dash bytes into a position the program still reads options in. Every one of those fails identically on every retry, which is why none is retryable.

Source

pub async fn run( &self, arguments: &BTreeMap<String, Value>, context: &ActivityContext, ) -> Result<ShellOutcome, ActivityFailure>

Run the command with arguments bound to its declared parameters.

Two things end the command early and both reach the same termination ladder the string-body executor uses — SIGTERM → grace → SIGKILL across the whole process group, with the verdict withheld until the group has been proven gone. The first is the activity being cancelled. The second is the command’s OWN declared timeout, which is enforced here, where the process is: a deadline applied only to the waiting side stops a caller waiting and leaves a process running.

§Errors

Returns a terminal ActivityFailure for a render refusal, a command that cannot be spawned or observed, a cancellation, or a declared timeout; and a retryable one for a non-zero exit, carrying the exit code and the command’s own standard error.

Trait Implementations§

Source§

impl Clone for DeclaredCommandAction

Source§

fn clone(&self) -> DeclaredCommandAction

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 DeclaredCommandAction

Source§

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

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, <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.
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