derive-new
derive-new copied to clipboard
Struct member is private
I want to define const struct like Python DataClasses I have 2 files
1st is datatype.rs
use derive_new::new;
#[derive(new)]
struct NameSpaces {
#[new(value = "\"/dog\".to_string()")]
dog: String,
#[new(value = "\"/cat\".to_string()")]
cat: String,
}
2nd is main.rx
mod datatype;
#[tokio::main]
async fn main() {
let ns = datatype::NameSpaces::new();
println!("{}", ns.dog);
std::future::pending::<()>().await;
}
Issue is
field `dog` of `NameSpaces` is private
Does it possible to change it to global ??