Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement serde_with::SerializeAs and serde_with ::DeserializeAs for ArrayVec #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 29, 2023

  1. Implement SerializeAs and DeserializeAs for ArrayVec

    `serde_with` is a widely used crate (24M downloads) to allow custom (de)serialisation.
    
    This commit allow to use Arrayvec as a container in the `serde_with::serde_as` macro.
    
    ```rust
    #[serde_as]
    #[derive(Serialize, Deserialize)]
    pub struct Native {
        #[serde_as(as = "ArrayVec<DisplayFromStr,128>")]
        pub sans: ArrayVec<TypeWithoutSerde, 128>,
    }
    ```
    
    I've it included under the `serde` feature, but it can be on its own feature.
    
    If this is deemed to niche to include, an alternative would be to include it directly in the `serde_with` crate under a feature flag, similar to what is done for other popular library, such as `hashbrown_0_14` or `chrono_0_4`. It has the disadvantage of pinning to one version.
    kraktus committed Sep 29, 2023
    Configuration menu
    Copy the full SHA
    8e05b49 View commit details
    Browse the repository at this point in the history