pub struct DeclaredCommandContract {
pub name: String,
pub parameters: Vec<CommandParameterContract>,
pub lines: Vec<CommandLineContract>,
pub env: Vec<EnvBindingContract>,
pub cwd: Option<String>,
pub prior_form_refusal: Option<String>,
}Expand description
The emitted, executable form of one declared command.
Deserialization is hand-written (in [super::compat]): it reads this
shape as written, and reads the PRIOR archive form — program words plus
args slots — by translating it into this shape at the wire, so an
archive deployed before the reshape still opens everywhere.
Fields§
§name: StringThe declaration’s own name, carried so a refusal can say which command it is talking about.
parameters: Vec<CommandParameterContract>The declared parameters, in declared order.
lines: Vec<CommandLineContract>The body’s logical lines, in execution order.
env: Vec<EnvBindingContract>The document’s exported environment bindings, in declared order.
cwd: Option<String>The document’s declared working directory, verbatim — any
{workspace_root} placeholder unexpanded, because expanding it is
the executing side’s act against ITS workspace.
prior_form_refusal: Option<String>Set ONLY by the prior-archive reader ([super::compat]), naming a
construct of the prior form this shape cannot express faithfully. A
contract carrying it still reads, lists and censuses everywhere;
Self::render refuses it with the construct and the cure, so the
unexpressible part can never execute as something it did not mean.
The emitter never sets it.
Implementations§
Source§impl DeclaredCommandContract
impl DeclaredCommandContract
Sourcepub fn parameter_names(&self) -> Vec<&str>
pub fn parameter_names(&self) -> Vec<&str>
Every parameter name this command declares, in declared order.
Sourcepub fn render(
&self,
supplied: &BTreeMap<String, ArgumentValue>,
) -> Result<RenderedCommand, RenderError>
pub fn render( &self, supplied: &BTreeMap<String, ArgumentValue>, ) -> Result<RenderedCommand, RenderError>
Resolve this command against supplied.
supplied must name only parameters this command declares — a name it
does not is refused rather than ignored, because a value nothing
consumes is a value nobody reviewed. A caller holding a WIDER set (an
action’s parameters, say, of which the command uses some) narrows it
first with Self::parameter_names.
§Errors
Returns the first refusal the resolution earns: an undeclared or missing argument, a list where one value belongs, a leading-dash operand standing where the program still reads options, or a body that reads a parameter the command does not declare.
Trait Implementations§
Source§impl Clone for DeclaredCommandContract
impl Clone for DeclaredCommandContract
Source§fn clone(&self) -> DeclaredCommandContract
fn clone(&self) -> DeclaredCommandContract
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeclaredCommandContract
impl Debug for DeclaredCommandContract
Source§impl<'de> Deserialize<'de> for DeclaredCommandContract
impl<'de> Deserialize<'de> for DeclaredCommandContract
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for DeclaredCommandContract
Source§impl PartialEq for DeclaredCommandContract
impl PartialEq for DeclaredCommandContract
Source§impl Serialize for DeclaredCommandContract
impl Serialize for DeclaredCommandContract
impl StructuralPartialEq for DeclaredCommandContract
Auto Trait Implementations§
impl Freeze for DeclaredCommandContract
impl RefUnwindSafe for DeclaredCommandContract
impl Send for DeclaredCommandContract
impl Sync for DeclaredCommandContract
impl Unpin for DeclaredCommandContract
impl UnsafeUnpin for DeclaredCommandContract
impl UnwindSafe for DeclaredCommandContract
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.