79806428

Date: 2025-11-01 09:09:49
Score: 0.5
Natty:
Report link

In addition to @standard_revolution answer, I had to specify #[serde(default)]

#[derive(Deserialize)]
#[serde(default)]
struct PageParams {
    limit: i64,
    offset: i64,
}

impl Default for PageParams {
    fn default() -> Self {
        PageParams {
            limit: 10,
            offset: 0,
        }
    }
}

#[get("/list")]
async fn list(query: web::Query<PageParams>) -> impl Responder { ... }
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @standard_revolution
Posted by: max-lt