pub trait LinkParser: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn supports(&self, link: &Link) -> bool;
fn parse<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
link: &'life1 Link,
options: &'life2 ParseOptions,
) -> Pin<Box<dyn Future<Output = Result<Resource>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Turns a raw Link into a Resource. Parsers may perform network I/O to
discover file lists (Hub) but must not transfer file contents.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Short, stable identifier such as http or huggingface, used in
diagnostics and reported by Router.
Sourcefn supports(&self, link: &Link) -> bool
fn supports(&self, link: &Link) -> bool
Returns true when this parser claims link. The check must be cheap
and free of side effects, because registration order decides which
parser is asked first.
Sourcefn parse<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
link: &'life1 Link,
options: &'life2 ParseOptions,
) -> Pin<Box<dyn Future<Output = Result<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn parse<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
link: &'life1 Link,
options: &'life2 ParseOptions,
) -> Pin<Box<dyn Future<Output = Result<Resource>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Builds the protocol-agnostic resource for a claimed link.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".