pub fn encode(
resources: &[ResourceSpec],
address: &ActionAddress,
argument: Option<&str>,
) -> Result<EncodedAction, ApiError>Expand description
Turn an address plus its argument into the replayable action it
names. Split out from invoke so a host can build/inspect/route
the encoded action itself, and so argument rules are checked in one
place. Binding happens before anything runs, so a bad call is a
refusal with the document untouched, never a half-applied edit.
§Errors
Returns ApiError::Unknown if address names no resource/action
in resources; ApiError::UnexpectedArgument if argument is
Some for an ActionInput::Immediate action; or
ApiError::MissingArgument if it’s None for an
ActionInput::Prompted one whose text is required.