MCPcopy Create free account
hub / github.com/daisy/MathCAT / as_vec_checked

Function as_vec_checked

src/speech.rs:189–193  ·  view source on GitHub ↗

Returns the Yaml as a `Vec` or an error if it isn't.

(value: &Yaml)

Source from the content-addressed store, hash-verified

187
188/// Returns the Yaml as a `Vec` or an error if it isn't.
189pub fn as_vec_checked(value: &Yaml) -> Result<&Vec<Yaml>> {
190 let result = value.as_vec();
191 let result = result.ok_or_else(|| yaml_type_err(value, "array"))?;
192 return Ok( result );
193}
194
195/// Returns the Yaml as a `&str` or an error if it isn't.
196pub fn as_str_checked(yaml: &Yaml) -> Result<&str> {

Callers 1

Calls 1

yaml_type_errFunction · 0.85

Tested by

no test coverage detected