greyblake / nutype

Rust newtype with guarantees 🇺🇦 🦀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Derive Serialize and Deserialize for newtype with generics

greyblake opened this issue · comments

Something like this is expected to work:

#[nutype(
    derive(Serialize, Deserialize)
)]
struct Collection<T(Vec<T>);

#[nutype(
    derive(
        Debug,
        Serialize,
        Deserialize,
    ),
)]
pub struct Borrowing<'a>(Cow<'a, str>);

Add test coverage:

  • With validation
  • Without validation

Partially addressed in #144
Fully will be addressed along with #142

Addressed in #142