Function encode
pub fn encode(
resources: &[Resource],
address: &ActionAddress,
argument: Option<&str>,
) -> Result<EncodedAction, DoorError>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 DoorError::Unknown if address names no resource/action
in resources; DoorError::UnexpectedArgument if argument is
Some for an ActionInput::Immediate action; or
DoorError::MissingArgument if it’s None for an
ActionInput::Prompted one.