#![allow(dead_code)] use std::marker::PhantomData; #[allow(non_snake_case)] mod A { use destructure::Destructure; #[derive(Destructure)] pub struct Book { id: crate::NumId, name: String, published_at: String, author: String, } impl Book { pub fn new(id: impl Into, name: impl Into, published_at: impl Into, author: impl Into) -> Self { Self { id: crate::NumId::new(id), name: name.into(), published_at: published_at.into(), author: author.into() } } } } pub struct NumId { id: i32, _mark: PhantomData } impl NumId { pub fn new(id: impl Into) -> Self { Self { id: id.into(), _mark: PhantomData } } } #[allow(unused)] fn main() { let book = A::Book::new(123456789, "name", "2023/01/03", "author"); let des = book.into_destruct(); }