From f1c79a459b0ab576e0c363dc0ff27d6d1ffee35c Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 26 Nov 2024 18:56:29 +0100 Subject: [PATCH] Simplify todos_index in todos example (#3048) --- examples/todos/src/main.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 6f115daf..cef395b7 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -82,14 +82,9 @@ pub struct Pagination { pub limit: Option, } -async fn todos_index( - pagination: Option>, - State(db): State, -) -> impl IntoResponse { +async fn todos_index(pagination: Query, State(db): State) -> impl IntoResponse { let todos = db.read().unwrap(); - let Query(pagination) = pagination.unwrap_or_default(); - let todos = todos .values() .skip(pagination.offset.unwrap_or(0))