Utility libraries in Rust.
A new type can be automatically generated without the specified fields based on a specific type. It is inspired by Omit of TypeScript.
use evil::Omit;
#[derive(Omit, Debug)]
#[omit(NewHoge, id, derive(Debug, Clone))]
struct Hoge {
pub id: u64,
pub age: u64,
}
The above code generates the following code.
#[derive(Debug, Clone))]
struct NewHoge {
pub age: u64,
}
A new type can be automatically generated without the specified fields based on a specific type. It is inspired by Pick of TypeScript.
use evil::Pick;
#[derive(Pick, Debug)]
#[pick(NewHoge, id, derive(Debug, Clone))]
struct Hoge {
pub id: u64,
pub age: u64,
}
The above code generates the following code.
#[derive(Debug, Clone))]
struct NewHoge {
pub id: u64,
}