Trait ammonia::UrlRelativeEvaluate

source ·
pub trait UrlRelativeEvaluate<'a>:
    Send
    + Sync
    + 'a {
    // Required method
    fn evaluate<'url>(&self, _: &'url str) -> Option<Cow<'url, str>>;
}
Expand description

Types that implement this trait can be used to convert a relative URL into an absolute URL.

This evaluator is only called when the URL is relative; absolute URLs are not evaluated.

See url_relative for more details.

Required Methods§

source

fn evaluate<'url>(&self, _: &'url str) -> Option<Cow<'url, str>>

Return None to remove the attribute. Return Some(str) to replace it with a new string.

Implementors§

source§

impl<'a, T> UrlRelativeEvaluate<'a> for T
where T: Fn(&str) -> Option<Cow<'_, str>> + Send + Sync + 'a,