| Crates.io | catfishing |
| lib.rs | catfishing |
| version | 0.0.1 |
| created_at | 2025-05-06 21:07:44.622619+00 |
| updated_at | 2025-05-06 21:07:44.622619+00 |
| description | Steal fields of another struct |
| homepage | |
| repository | https://github.com/tkr-sh/catfishing |
| max_upload_size | |
| id | 1662989 |
| size | 25,702 |
catfishing
#[catfishing(Robot)]
struct Human {
age: usize,
name: &'static str,
}
struct Robot(Human);
fn main() {
let human = Human { age: 42, name: "John" };
let robot = Robot(human);
assert_eq!(robot.age(), 42);
assert_eq!(robot.name(), "John");
}