invade

Crates.ioinvade
lib.rsinvade
version0.0.6
sourcesrc
created_at2024-02-12 22:27:04.786712
updated_at2024-02-14 01:31:10.939981
descriptionA library to reflect on Rust types and generate code
homepage
repositoryhttps://github.com/KABBOUCHI/invade
max_upload_size
id1137370
size9,437
Georges KABBOUCHI (KABBOUCHI)

documentation

README

invade

Setup

cargo add invade

Usage

use invade::invade;

#[invade]
struct Counter {
    count: u32,
}

#[invade]
impl Counter {
    fn inc(&mut self) {
        self.count += 1;
    }
}

fn main() {
    let mut counter = Counter { count: 0 };
  
    println!("count: {:?}", counter.invade_get::<u32>("count"));

    counter.invade_set("count", 1_u32);

    assert_eq!(counter.count, 1);

    counter.invade_call("inc", vec![]);

    assert_eq!(counter.count, 2);
}
Commit count: 0

cargo fmt