logo
macro_rules! extension {
    ($trait: ty, $ret: ty, $(($meta:tt) ,)? | $($param:tt:$param_type:ty:$name:ident ),* |, $(($($(($mut:tt))? $move:ident:$ty:ty),+))?, $code:block) => { ... };
}
Expand description

The ultimate extension-creation macro.

This is used in the various other macros which expand to extensions; use them instead!

Examples

This is similar to the prepare! macro.

extension!(
    kvarn::extensions::PrepareCall,
    FatResponse,
    | request: &'a mut FatRequest: arg1,
    host: &'a Host: arg2,
    path: Option<&'a Path>: arg3,
    addr: SocketAddr: arg4 |, , {
        println!("Hello world, from extension macro!");
        FatResponse::no_cache(Response::new(Bytes::from_static(b"Hi!")))
    }
);