From c68a38a6316b7e8d8451a3857447f73c4df9147d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ma=C4=87kowski?= Date: Sat, 3 May 2025 23:46:37 +0200 Subject: [PATCH] chore(docs): improve `RequestHandler` docs --- cot/src/handler.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cot/src/handler.rs b/cot/src/handler.rs index edeab56d5..64eff45dc 100644 --- a/cot/src/handler.rs +++ b/cot/src/handler.rs @@ -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`]. +/// 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",