#[non_exhaustive]pub enum Action {
Symlink(SymlinkArgs),
Unlink(UnlinkArgs),
Env(EnvArgs),
Mkdir(MkdirArgs),
Rmdir(RmdirArgs),
Require(RequireSpec),
When(WhenSpec),
Exec(ExecSpec),
}Expand description
One entry in a pack’s actions: (or teardown:) list.
Marked #[non_exhaustive] because M4 ships plugin-contributed action
kinds; external match sites must carry a _ arm so the Tier-1 registry
can grow without a major-version bump.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Symlink(SymlinkArgs)
symlink primitive.
Unlink(UnlinkArgs)
Synthesized inverse of symlink for auto-reverse teardown
(R-M5-09). Not a YAML-parseable action.
Env(EnvArgs)
env primitive.
Mkdir(MkdirArgs)
mkdir primitive.
Rmdir(RmdirArgs)
rmdir primitive.
Require(RequireSpec)
require gate.
When(WhenSpec)
when conditional block.
Exec(ExecSpec)
exec shell escape.
Implementations§
Source§impl Action
impl Action
Sourcepub fn from_yaml(value: &Value) -> Result<Self, PackParseError>
pub fn from_yaml(value: &Value) -> Result<Self, PackParseError>
Parse a single action entry from a YAML value.
Rejects zero-key and multi-key entries with
PackParseError::EmptyActionEntry / PackParseError::MultipleActionKeys,
and unknown keys with PackParseError::UnknownActionKey.
Sourcepub fn parse_list(value: Option<&Value>) -> Result<Vec<Self>, PackParseError>
pub fn parse_list(value: Option<&Value>) -> Result<Vec<Self>, PackParseError>
Parse an entire actions: sequence.
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Short kebab-case identifier matching the YAML key that produced this
variant (and the name plugins register under). Returned as
&'static str so callers can zero-cost compare against constants
like ACTION_SYMLINK (defined in the execute::step module).
Sourcepub fn iter_symlinks(&self) -> Box<dyn Iterator<Item = &SymlinkArgs> + '_>
pub fn iter_symlinks(&self) -> Box<dyn Iterator<Item = &SymlinkArgs> + '_>
Walk this action (and any nested when.actions) yielding every
SymlinkArgs reached.
Action::Symlinkyields the wrapped args.Action::Whenrecurses intowhen.actions(which themselves may bewhenblocks — recursion is unbounded because the parse-time depth bound applies to predicate trees, not action nesting; in practice authors do not nestwhendeeply, and validators consume whatever the parser accepted).- Every other variant yields an empty iterator.
The iterator is boxed so variant-specific concrete iterator types can share a single return shape. Boxing cost is negligible against the outer YAML parse and well-bounded action lists; swapping to a custom enum-iterator later is YAGNI for now.
Trait Implementations§
impl Eq for Action
impl StructuralPartialEq for Action
Auto Trait Implementations§
impl Freeze for Action
impl RefUnwindSafe for Action
impl Send for Action
impl Sync for Action
impl Unpin for Action
impl UnsafeUnpin for Action
impl UnwindSafe for Action
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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