Skip to main content

parse_api_str

Function parse_api_str 

Source
pub fn parse_api_str(s: &str, format: &str) -> Result<Api, ParseError>
Expand description

Parse IDL source text in the given format into an Api.

format selects the deserializer: yaml or yml for YAML, json for JSON, and toml for TOML. On failure the returned ParseError captures the source text and, when the deserializer reports one, a span for a rich diagnostic.

§Errors

Returns ParseError::UnsupportedFormat when format isn’t a recognized format string, or the matching Yaml, Json, or Toml variant when the source text is malformed or doesn’t match the schema.