crabstructor

Crates.iocrabstructor
lib.rscrabstructor
version0.2.1-beta
sourcesrc
created_at2024-08-25 18:47:22.642972
updated_at2024-09-04 19:45:17.159078
descriptionSimple constructor generator for named structures
homepage
repository
max_upload_size
id1351362
size24,990
still working... (europeDreadlyDevil)

documentation

README

CrabStructor v0.2.0-beta

Init with literal

#[derive(Constructor, PartialEq, Debug)]
struct Example {
    #[init(10)]
    field: i32,
}

assert_eq!(Example::new(), Example {field: 10});

Call new func

#[derive(Constructor, PartialEq, Debug)]
struct Example {
    #[new("string")]
    field: Arc<String>,
}

assert_eq!(Example::new(), Example {field: Arc::new("string".into())});
#[derive(Constructor, PartialEq, Debug)]
struct Example {
    #[new(arc_string: String)]
    field: Arc<String>,
}

assert_eq!(Example::new("string".to_string()), Example {field: Arc::new("string".into())});

Alert

This is dev version of lib

Supported types

  1. All strings, which implement "Into" trait
  2. All rust nums
  3. Bool types
Commit count: 0

cargo fmt