#query-string #axum #deserialize #serde #serialization #derive-deserialize

serde-querystring-axum

基于serde-querystring的axum查询字符串提取器

2个不稳定版本

0.3.0-beta.02024年8月8日
0.2.0 2023年2月1日

#2#querystring

Download history 10/week @ 2024-04-18 4/week @ 2024-04-25 13/week @ 2024-05-09 48/week @ 2024-05-16 42/week @ 2024-05-23 69/week @ 2024-05-30 53/week @ 2024-06-06 24/week @ 2024-06-13 44/week @ 2024-06-20 86/week @ 2024-06-27 37/week @ 2024-07-04 37/week @ 2024-07-11 48/week @ 2024-07-18 28/week @ 2024-07-25 19/week @ 2024-08-01

137 每月下载量

MIT/Apache

105KB
2.5K SLoC

serde-querystring for axum

此crate提供了一个用于serde-querystring的提取器,可以用作axum::extract::Query提取器的替代。

use serde::Deserialize;
use serde_querystring_axum::QueryString;

#[derive(Deserialize)]
pub struct AuthRequest {
   id: u64,
   scopes: Vec<u64>,
}

// In your handler
async fn index(QueryString(info): QueryString<AuthRequest>) -> String {
    format!("Authorization request for client with id={} and type={:?}!", info.id, info.scopes)
}

依赖

~1.7–2.6MB
~52K SLoC