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§
Sourcefn 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<'life0, 'async_trait>(
&'life0 self,
path: PathBuf,
) -> Pin<Box<dyn Future<Output = Layer3Result<Document>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
加载文档
Sourcefn 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 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,
加载并分块
Sourcefn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
获取支持的扩展名列表
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".