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§
Sourcefn format_info(&self) -> &FormatInfo
fn format_info(&self) -> &FormatInfo
Get information about this format
Sourcefn export_to_writer(
&self,
document: &EditorDocument,
writer: &mut dyn Write,
options: &FormatOptions,
) -> Result<FormatResult, EditorError>
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§
Sourcefn can_export(&self, extension: &str) -> bool
fn can_export(&self, extension: &str) -> bool
Check if this exporter can handle the given file extension
Sourcefn export_to_path(
&self,
document: &EditorDocument,
path: &Path,
options: &FormatOptions,
) -> Result<FormatResult, EditorError>
fn export_to_path( &self, document: &EditorDocument, path: &Path, options: &FormatOptions, ) -> Result<FormatResult, EditorError>
Export to a file path
Sourcefn export_to_string(
&self,
document: &EditorDocument,
options: &FormatOptions,
) -> Result<(String, FormatResult), EditorError>
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".