pub struct DocumentLoader;Expand description
Document loader for YAML and Markdown formats
Implementations§
Source§impl DocumentLoader
impl DocumentLoader
Sourcepub fn load_from_file<P: AsRef<Path>>(path: P) -> StorageResult<Document>
pub fn load_from_file<P: AsRef<Path>>(path: P) -> StorageResult<Document>
Load a document from a file
Automatically detects format based on file extension. Supports YAML (.yaml, .yml) and Markdown (.md, .markdown) formats.
Sourcepub fn load_from_string(content: String, format: DocumentFormat) -> Document
pub fn load_from_string(content: String, format: DocumentFormat) -> Document
Load a document from a string with specified format
Sourcepub fn save_to_file<P: AsRef<Path>>(
document: &Document,
path: P,
) -> StorageResult<()>
pub fn save_to_file<P: AsRef<Path>>( document: &Document, path: P, ) -> StorageResult<()>
Save a document to a file
Sourcepub fn extension_for_format(format: DocumentFormat) -> &'static str
pub fn extension_for_format(format: DocumentFormat) -> &'static str
Get the file extension for a document format
Sourcepub fn detect_format<P: AsRef<Path>>(path: P) -> StorageResult<DocumentFormat>
pub fn detect_format<P: AsRef<Path>>(path: P) -> StorageResult<DocumentFormat>
Detect format from file extension
Auto Trait Implementations§
impl Freeze for DocumentLoader
impl RefUnwindSafe for DocumentLoader
impl Send for DocumentLoader
impl Sync for DocumentLoader
impl Unpin for DocumentLoader
impl UnwindSafe for DocumentLoader
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