diff options
| author | Fuwn <[email protected]> | 2022-03-27 11:13:24 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-27 11:13:24 +0000 |
| commit | c69f40fc8f4bfe2c6b0bac64966d647fb313a02c (patch) | |
| tree | c95a22a6e2cc76318b539be9acac9e7f0274e962 /examples | |
| parent | feat(error_handle): fnmut closure (diff) | |
| download | windmark-c69f40fc8f4bfe2c6b0bac64966d647fb313a02c.tar.xz windmark-c69f40fc8f4bfe2c6b0bac64966d647fb313a02c.zip | |
feat(pre/post_route_callback): fnmut closure
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/windmark.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/windmark.rs b/examples/windmark.rs index a5bfc9a..21c84a8 100644 --- a/examples/windmark.rs +++ b/examples/windmark.rs @@ -41,19 +41,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { .attach(|r| { r.mount("/module", |_| Response::Success("This is a module!".into())); }) - .set_pre_route_callback(|stream, url, _| { + .set_pre_route_callback(Box::new(|stream, url, _| { info!( "accepted connection from {} to {}", stream.peer_addr().unwrap().ip(), url.to_string() ) - }) - .set_post_route_callback(|stream, _url, _| { + })) + .set_post_route_callback(Box::new(|stream, _url, _| { info!( "closed connection from {}", stream.peer_addr().unwrap().ip() ) - }) + })) .set_header(|_| "```\nART IS COOL\n```".to_string()) .set_footer(|_| "Copyright 2022".to_string()) .mount("/", |_| { |