use struct_convert::Convert; #[derive(Debug, PartialEq)] struct B { num: String, name: String, } #[derive(Debug, Convert, PartialEq)] #[convert(into = "B")] struct A { #[convert_field(ignore)] id: i64, #[convert_field(to_string)] num: i64, #[convert_field(unwrap)] name: Option, } fn main() {} #[test] fn test_ignore() { let a = A { id: 2, num: 1, name: Some("Jack".to_string()), }; let b: B = a.into(); debug_assert_eq!( B { num: "1".to_string(), name: "Jack".to_string(), }, b ); }