Skip to content

Commit

Permalink
Simplify todos_index in todos example (#3048)
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte authored Nov 26, 2024
1 parent 69a89c0 commit f1c79a4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions examples/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,9 @@ pub struct Pagination {
pub limit: Option<usize>,
}

async fn todos_index(
pagination: Option<Query<Pagination>>,
State(db): State<Db>,
) -> impl IntoResponse {
async fn todos_index(pagination: Query<Pagination>, State(db): State<Db>) -> impl IntoResponse {
let todos = db.read().unwrap();

let Query(pagination) = pagination.unwrap_or_default();

let todos = todos
.values()
.skip(pagination.offset.unwrap_or(0))
Expand Down

0 comments on commit f1c79a4

Please sign in to comment.