use std::borrow::Cow;
use std::time::Instant;
pub struct FilteredImage<'a> {
pub src: Cow<'a, str>,
pub srcset: Option<Cow<'a, str>>,
pub width: Option<u32>,
pub height: Option<u32>,
}
pub trait ImageFilter: Send + Sync + 'static {
fn filter_url<'a>(&self, url: &'a str, wanted_width: Option<u32>, wanted_height: Option<u32>, _container_width: u32, deadline: Instant) -> FilteredImage<'a>;
}
impl ImageFilter for () {
fn filter_url<'a>(&self, url: &'a str, width: Option<u32>, height: Option<u32>, _container_width: u32, _deadline: Instant) -> FilteredImage<'a> {
FilteredImage {
src: url.into(),
srcset: None,
width, height,
}
}
}