Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struct member is private #68

Open
aminballoon opened this issue Jul 2, 2024 · 0 comments
Open

Struct member is private #68

aminballoon opened this issue Jul 2, 2024 · 0 comments

Comments

@aminballoon
Copy link

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 ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant