pub trait LinkExpander: Send + Sync {
// Required methods
fn enabled(&self, config: &BabyriteConfig) -> bool;
fn expand_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cx: &'life1 ExpandContext<'life2>,
) -> Pin<Box<dyn Future<Output = Vec<ExpandedContent>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
A link expander: parses its own link type out of a message and expands
each link into ExpandedContent.
Adding a new link type means implementing this trait and registering the
expander in EXPANDERS; the event handler needs no changes.
Required Methods§
Sourcefn enabled(&self, config: &BabyriteConfig) -> bool
fn enabled(&self, config: &BabyriteConfig) -> bool
Whether this expander is enabled under config.
Sourcefn expand_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cx: &'life1 ExpandContext<'life2>,
) -> Pin<Box<dyn Future<Output = Vec<ExpandedContent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn expand_all<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
cx: &'life1 ExpandContext<'life2>,
) -> Pin<Box<dyn Future<Output = Vec<ExpandedContent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Parses and expands all links of this expander’s type in the message.
Failures are logged per link and never abort the other links or expanders, so this returns only the successful expansions.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".