···11+# Examples
22+33+## [Async Stateful Module](./async_stateful_module.rs)
44+55+`cargo run --example async_stateful_module --features response-macros`
66+77+Demonstrates use of the `AsyncModule` trait by implementing the module
88+`Clicker` which tracks the global number of visits to the capsule.
99+1010+This can easily be adapted to contain a hashmap of routes which are individually
1111+tracked for clicks.
1212+1313+## [Async](./async.rs)
1414+1515+`cargo run --example async --features response-macros`
1616+1717+Demonstrates use of async routes through an async response macro and
1818+implementing a click tracker using a shared variable through an thread-safe,
1919+async mutex.
2020+2121+## [Binary](./binary.rs)
2222+2323+`cargo run --example binary --features response-macros`
2424+2525+Demonstrates the binary response functionality by using both manual
2626+and automatic mime resolution (`--features auto-deduce-mime`).
2727+2828+## [Callbacks](./callbacks.rs)
2929+3030+`cargo run --example callbacks`
3131+3232+Demonstrates use of the pre and post-route callback handlers.
3333+3434+## [Certificate](./certificate.rs)
3535+3636+`cargo run --example certificate --features response-macros`
3737+3838+Demonstrate the various certificate related responses as well as
3939+reading the client certificate to give conditional access.
4040+4141+## [Default Logger](./default_logger.rs)
4242+4343+`cargo run --example default_logger --features logger,response-macros`
4444+4545+A simple example showing the use of the default default logger implementation.
4646+4747+## [Empty](./empty.rs)
4848+4949+`cargo run --example empty`
5050+5151+An empty example which starts up a server but has no mounted routes.
5252+5353+## [Error Handler](./error_handler.rs)
5454+5555+`cargo run --example error_handler`
5656+5757+Creates an intentional error within a route, invoking the error handler.
5858+5959+## [Fix Path](./fix_path.rs)
6060+6161+`cargo run --example fix_path --features response-macros`
6262+6363+A simple example which demonstrates use of the path fixer that attempts to resolve the closest match of a route when an invalid route is visited.
6464+6565+This feature is limited to simple resolution patches such as resolving
6666+trailing and missing trailing slashes. If your capsule requires a more sophisticated path fixer, please use any of the provided mechanisms to do so before your routes execute.
6767+6868+## [Input](./input.rs)
6969+7070+`cargo run --example input`
7171+7272+Demonstrates how to accept and inspect both standard and sensitive input.
7373+7474+## [MIME](./mime.rs)
7575+7676+`cargo run --example mime`
7777+7878+Demonstrate how to modify the MIME of a response before use.
7979+8080+## [Parameters](./parameters.rs)
8181+8282+`cargo run --example parameters --features response-macros`
8383+8484+Demonstrate the use of route parameters (not URL queries).
8585+8686+## [Partial](./partial.rs)
8787+8888+`cargo run --example partial`
8989+9090+Demonstrates use of appending headers and footers to routes, globally.
9191+9292+If you would like to conditionally append headers and footers based on route, please look into using a templating framework.
9393+9494+## [Query](./query.rs)
9595+9696+`cargo run --example input --features response-macros`
9797+9898+Demonstrates the inspection of URL queries parameters.
9999+100100+## [Responses](./responses.rs)
101101+102102+`cargo run --example responses --features response-macros`
103103+104104+Demonstrates the use of a wide variety of responses, additionally exposing the flexibility of response bodies types.
105105+106106+## [Simple `async-std`](./simple_async_std.rs)
107107+108108+`cargo run --example simple_async_std --features async-std`
109109+110110+Demonstrates how to explicitly specify Windmark to use the [`async-std`](https://github.com/async-rs/async-std) runtime.
111111+112112+If the `async-std` feature is NOT enabled, Windmark will default to using Tokio as the async runtime.
113113+114114+## [Simple Tokio](./simple_tokio.rs)
115115+116116+`cargo run --example simple_async_std --features async-std`
117117+118118+Demonstrates how to explicitly specify Windmark to use the [Tokio](https://github.com/tokio-rs/tokio) runtime.
119119+120120+## [Stateful Module](./stateful_module.rs)
121121+122122+`cargo run --example stateful_module --features response-macros`
123123+124124+Demonstrates use of `Module`s by implementing a click tracker
125125+126126+Identical in functionality to the Async Stateful Module example, just not asynchronous.
127127+128128+## [Stateless Module](./stateless_module.rs)
129129+130130+`cargo run --example stateless_module`
131131+132132+Demonstrates use of a stateless module.
133133+134134+Unlike a `Module`, a stateless module is not encapsulated into a `struct`, but is a simple function which is used to perform operations.
135135+136136+Stateless modules are able to emulate stateful modules employing `static` variables. The earliest Windmark modules (add-ons) were made this way.
137137+138138+The only requirement of a module is to implement the signature of a stateless module: `FnMut(&mut Router) -> ()`.
···1515// Copyright (C) 2022-2023 Fuwn <contact@fuwn.me>
1616// SPDX-License-Identifier: GPL-3.0-only
17171818-//! `cargo run --example binary`
1818+//! `cargo run --example binary --features response-macros`
1919//!
2020//! Optionally, you can run this example with the `auto-deduce-mime` feature
2121//! enabled.