Skip to main content

FormatExporter

Trait FormatExporter 

Source
pub trait FormatExporter:
    Debug
    + Send
    + Sync {
    // Required methods
    fn format_info(&self) -> &FormatInfo;
    fn export_to_writer(
        &self,
        document: &EditorDocument,
        writer: &mut dyn Write,
        options: &FormatOptions,
    ) -> Result<FormatResult, EditorError>;

    // Provided methods
    fn can_export(&self, extension: &str) -> bool { ... }
    fn export_to_path(
        &self,
        document: &EditorDocument,
        path: &Path,
        options: &FormatOptions,
    ) -> Result<FormatResult, EditorError> { ... }
    fn export_to_string(
        &self,
        document: &EditorDocument,
        options: &FormatOptions,
    ) -> Result<(String, FormatResult), EditorError> { ... }
}
Available on crate feature std only.
Expand description

Trait for exporting EditorDocument to subtitle files

Required Methods§

Source

fn format_info(&self) -> &FormatInfo

Get information about this format

Source

fn export_to_writer( &self, document: &EditorDocument, writer: &mut dyn Write, options: &FormatOptions, ) -> Result<FormatResult, EditorError>

Export to a writer with the given options

Provided Methods§

Source

fn can_export(&self, extension: &str) -> bool

Check if this exporter can handle the given file extension

Source

fn export_to_path( &self, document: &EditorDocument, path: &Path, options: &FormatOptions, ) -> Result<FormatResult, EditorError>

Export to a file path

Source

fn export_to_string( &self, document: &EditorDocument, options: &FormatOptions, ) -> Result<(String, FormatResult), EditorError>

Export to a string

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§