Skip to main content

DocumentLoader

Trait DocumentLoader 

Source
pub trait DocumentLoader: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
        path: PathBuf,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Document>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn load_and_split<'life0, 'async_trait>(
        &'life0 self,
        path: PathBuf,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<Document>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn supports(&self, path: &Path) -> bool;
    fn extensions(&self) -> &[&str];
}
Expand description

文档加载器 trait

定义文档加载的通用接口。

Required Methods§

Source

fn load<'life0, 'async_trait>( &'life0 self, path: PathBuf, ) -> Pin<Box<dyn Future<Output = Layer3Result<Document>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

加载文档

Source

fn load_and_split<'life0, 'async_trait>( &'life0 self, path: PathBuf, ) -> Pin<Box<dyn Future<Output = Layer3Result<Vec<Document>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

加载并分块

Source

fn supports(&self, path: &Path) -> bool

检查是否支持该文件类型

Source

fn extensions(&self) -> &[&str]

获取支持的扩展名列表

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§