Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions cot/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,22 @@ use crate::{Error, Result};
///
/// This is the main building block of a Cot app. You shouldn't
/// usually need to implement this directly, as it is already
/// implemented for closures and functions that take a [`Request`]
/// and return a [`Result<Response>`].
/// implemented for closures and functions that take some
/// number of [extractors](crate::request::extractors) as parameters
/// and return some type that [can be converted into a
/// response](IntoResponse).
///
/// # Details
///
/// Cot provides an implementation of `RequestHandler` for functions
/// and closures that:
/// * are marked `async`
/// * take at most 10 parameters, all of which implement [`FromRequestParts`],
/// except for at most one that implements [`FromRequest`]
/// * return a type that implements [`IntoResponse`]
/// * is `Clone + Send + 'static` (important if it's a closure)
/// * return a future that is `Send` (i.e., doesn't hold any non-Send references
/// across await points)
#[diagnostic::on_unimplemented(
message = "`{Self}` is not a valid request handler",
label = "not a valid request handler",
Expand Down