kvarn

Macro post

source
macro_rules! post {
    ($request:pat, $host:pat, $response_pipe:pat, $bytes:pat, $addr:pat, $(move |$($move:ident:$ty:ty ),+|)? $code:block) => { ... };
}
Expand description

Construct a Post extension like you write closures.

See crate::prepare! for usage and useful examples. See super::PostCall for a list of arguments.

ยงExamples

let extension = post!(_, _, response_pipe, _, _, {
    match response_pipe {
        application::ResponseBodyPipe::Http1(c) => println!("This is an HTTP/1 connection. {c:?}"),
        application::ResponseBodyPipe::Http2(c, _) => println!("This is an HTTP/2 connection. {c:?}"),
        application::ResponseBodyPipe::Http3(c) => println!("This is an HTTP/3 connection."),
    }
});