pub struct FormatConverter;Expand description
Converts specs between YAML and Markdown formats
Implementations§
Source§impl FormatConverter
impl FormatConverter
Sourcepub fn markdown_to_yaml(markdown_content: &str) -> Result<String, SpecError>
pub fn markdown_to_yaml(markdown_content: &str) -> Result<String, SpecError>
Convert a spec from Markdown format to YAML format
§Arguments
markdown_content- The Markdown spec content as a string
§Returns
The spec converted to YAML format, or an error if parsing/validation fails
§Errors
Returns SpecError if:
- The Markdown content cannot be parsed
- The parsed spec fails validation
Sourcepub fn convert(
content: &str,
from_format: &str,
to_format: &str,
) -> Result<String, SpecError>
pub fn convert( content: &str, from_format: &str, to_format: &str, ) -> Result<String, SpecError>
Convert a spec from one format to another
§Arguments
content- The spec content as a stringfrom_format- The source format (“yaml” or “markdown”)to_format- The target format (“yaml” or “markdown”)
§Returns
The spec converted to the target format, or an error if conversion fails
§Errors
Returns SpecError if:
- The source format is invalid
- The content cannot be parsed
- The parsed spec fails validation
Auto Trait Implementations§
impl Freeze for FormatConverter
impl RefUnwindSafe for FormatConverter
impl Send for FormatConverter
impl Sync for FormatConverter
impl Unpin for FormatConverter
impl UnwindSafe for FormatConverter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more