pub struct FormatRegistry { /* private fields */ }Available on crate feature
std only.Expand description
Registry for managing available formats
Implementations§
Source§impl FormatRegistry
impl FormatRegistry
Sourcepub fn register_format(&mut self, format: Box<dyn Format>)
pub fn register_format(&mut self, format: Box<dyn Format>)
Register a format that supports both import and export
Sourcepub fn register_importer(&mut self, importer: Box<dyn FormatImporter>)
pub fn register_importer(&mut self, importer: Box<dyn FormatImporter>)
Register an importer
Sourcepub fn register_exporter(&mut self, exporter: Box<dyn FormatExporter>)
pub fn register_exporter(&mut self, exporter: Box<dyn FormatExporter>)
Register an exporter
Sourcepub fn find_importer(&self, extension: &str) -> Option<&dyn FormatImporter>
pub fn find_importer(&self, extension: &str) -> Option<&dyn FormatImporter>
Find an importer for the given file extension
Sourcepub fn find_exporter(&self, extension: &str) -> Option<&dyn FormatExporter>
pub fn find_exporter(&self, extension: &str) -> Option<&dyn FormatExporter>
Find an exporter for the given file extension
Sourcepub fn supported_import_extensions(&self) -> Vec<String>
pub fn supported_import_extensions(&self) -> Vec<String>
Get all supported import extensions
Sourcepub fn supported_export_extensions(&self) -> Vec<String>
pub fn supported_export_extensions(&self) -> Vec<String>
Get all supported export extensions
Sourcepub fn import_file(
&self,
path: &Path,
options: Option<&FormatOptions>,
) -> Result<(EditorDocument, FormatResult), EditorError>
pub fn import_file( &self, path: &Path, options: Option<&FormatOptions>, ) -> Result<(EditorDocument, FormatResult), EditorError>
Import a file using the appropriate format
Sourcepub fn export_file(
&self,
document: &EditorDocument,
path: &Path,
options: Option<&FormatOptions>,
) -> Result<FormatResult, EditorError>
pub fn export_file( &self, document: &EditorDocument, path: &Path, options: Option<&FormatOptions>, ) -> Result<FormatResult, EditorError>
Export a document to a file using the appropriate format
Trait Implementations§
Source§impl Debug for FormatRegistry
impl Debug for FormatRegistry
Source§impl Default for FormatRegistry
impl Default for FormatRegistry
Source§fn default() -> FormatRegistry
fn default() -> FormatRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FormatRegistry
impl !RefUnwindSafe for FormatRegistry
impl Send for FormatRegistry
impl Sync for FormatRegistry
impl Unpin for FormatRegistry
impl !UnwindSafe for FormatRegistry
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