use super::super::super::super::transcoding::*;
use {http::request::*, http::*, std::sync::*};
pub type CacheableHook = Arc<Box<dyn Fn(CacheableHookContext) -> bool + Send + Sync>>;
pub type EncodableHook = Arc<Box<dyn Fn(EncodableHookContext) -> bool + Send + Sync>>;
pub type CacheKeyHook<CacheKeyT, RequestBodyT> =
Arc<Box<dyn Fn(CacheKeyHookContext<CacheKeyT, RequestBodyT>) + Send + Sync>>;
#[derive(Clone, Debug)]
pub struct CacheableHookContext<'own> {
pub uri: &'own Uri,
pub headers: &'own HeaderMap,
}
impl<'own> CacheableHookContext<'own> {
pub fn new(uri: &'own Uri, headers: &'own HeaderMap) -> Self {
Self { uri, headers }
}
}
#[derive(Clone, Debug)]
pub struct EncodableHookContext<'own> {
pub encoding: &'own Encoding,
pub uri: &'own Uri,
pub headers: &'own HeaderMap,
}
impl<'own> EncodableHookContext<'own> {
pub fn new(encoding: &'own Encoding, uri: &'own Uri, headers: &'own HeaderMap) -> Self {
Self { encoding, uri, headers }
}
}
#[derive(Debug)]
pub struct CacheKeyHookContext<'own, CacheKeyT, RequestBodyT> {
pub cache_key: &'own mut CacheKeyT,
pub request: &'own Request<RequestBodyT>,
}
impl<'own, CacheKeyT, RequestBodyT> CacheKeyHookContext<'own, CacheKeyT, RequestBodyT> {
pub fn new(cache_key: &'own mut CacheKeyT, request: &'own Request<RequestBodyT>) -> Self {
Self { cache_key, request }
}
}