Reputation: 29834
"field 0
of struct is private" error on pub struct attribute
pub struct A(String, String);
pub struct C {
pub b: Vec<A>,
}
...iter().map(|my_tuple:&A| (my_tuple.0.parse::<f64>().unwrap()));
Why do I get an "struct is private" error when the attribute is pub, the struct is pub and the parent struct is pub?
Upvotes: 0
Views: 3498
Reputation: 73520
You need to make the pieces of the tuple type A
pub
. Something like this:
pub struct A(pub String, pub String)
Upvotes: 7