pub struct Script {
pub steps: Vec<ScriptStep>,
pub on_failure: FailurePolicy,
pub metadata: Map<String, Value>,
}Expand description
A script document, including host policy and author-supplied document metadata.
Fields§
§steps: Vec<ScriptStep>§on_failure: FailurePolicy§metadata: Map<String, Value>Implementations§
Source§impl Script
impl Script
Sourcepub fn from_yaml(yaml: &str) -> Result<Self, FormatError>
pub fn from_yaml(yaml: &str) -> Result<Self, FormatError>
Parse and validate the entire flow before executing any of it. YAML comments and a UTF-8 BOM are accepted; every flow entry must have exactly one operation key.
§Errors
Returns a FormatError when the text is not valid YAML, contains a non-finite number, is
not a mapping with a flow: sequence, has an invalid on_failure, contains an invalid
step, or places expect_exit anywhere but last.
Sourcepub fn to_yaml(&self) -> String
pub fn to_yaml(&self) -> String
Serialize as the canonical single-key YAML form. Optional null parameters are omitted; author metadata and annotations are retained. The default failure policy is implicit.
§Panics
Panics if a step does not serialize as a JSON object or the document does not serialize as
YAML, neither of which a valid Script can cause.