2012-09-04 14:48:32 -07:00
|
|
|
mod cat {
|
2013-01-30 14:30:22 -08:00
|
|
|
pub struct Cat {
|
2015-01-08 22:02:42 +11:00
|
|
|
meows: usize
|
2012-09-04 14:48:32 -07:00
|
|
|
}
|
|
|
|
|
2013-01-30 14:30:22 -08:00
|
|
|
pub fn new_cat() -> Cat {
|
2012-09-04 14:48:32 -07:00
|
|
|
Cat { meows: 52 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let nyan = cat::new_cat();
|
2020-09-02 10:40:56 +03:00
|
|
|
assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `Cat` is private
|
2012-09-04 14:48:32 -07:00
|
|
|
}
|