actix_header

Crates.ioactix_header
lib.rsactix_header
version0.1.4
sourcesrc
created_at2022-09-04 09:36:28.750129
updated_at2022-09-04 15:49:18.572155
descriptionshortcut to implement actix-web headers
homepage
repository
max_upload_size
id658207
size3,438
wangjun (wangjun861205)

documentation

README

actix_header is a shortcut to implement actix-web Header, you only need to implement From<String> and Into<String> for your type, and then you can use your type in handlers directly.

example:

    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 {
        ...
    }

Commit count: 0

cargo fmt