pub trait Fetcher: Send + Sync {
// Required method
fn fetch<'life0, 'async_trait>(
&'life0 self,
req: FetchRequest,
) -> Pin<Box<dyn Future<Output = Result<String, FetchError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
取页抽象。实现者负责发请求 + 按目标站字符集解码为文本。
Required Methods§
Sourcefn fetch<'life0, 'async_trait>(
&'life0 self,
req: FetchRequest,
) -> Pin<Box<dyn Future<Output = Result<String, FetchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fetch<'life0, 'async_trait>(
&'life0 self,
req: FetchRequest,
) -> Pin<Box<dyn Future<Output = Result<String, FetchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
取一个页面的解码后文本。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".