1 个不稳定版本
| 0.1.4 | 2022年9月4日 | 
|---|---|
| 0.1.3 |  | 
| 0.1.2 |  | 
| 0.1.1 |  | 
| 0.1.0 |  | 
#16 in #shortcut
4KB
actix_header 是实现 actix-web Header 的快捷方式,您只需为您的类型实现 From<String> 和 Into<String>,然后您就可以直接在处理器中使用您的类型。
示例
    use actix_web::web::Header;
    use actix_header::actix_header;
    #[actix_header("X-CUSTOMIZED-HEADER")]
    struct MyCustomizedHeader(String);
    impl From<String> for MyCustomizedHeader {
        fn from(s: String) -> Self {
            Self(s)
        }
    }
    impl From<MyCustomizedHeader> for String {
        fn from(s: MyCustomizedHeader) -> Self {
            s.0
        }
    }
    async fn index(Header(MyCustomizedHeader(content))) -> AnyResponse {
        ...
    }
依赖项
~1.5MB
~36K SLoC