@@ -1527,12 +1527,9 @@ of an item to see whether it should be allowed or not. This is where privacy
1527
1527
warnings are generated, or otherwise "you used a private item of another module
1528
1528
and weren't allowed to."
1529
1529
1530
- By default, everything in rust is * private* , with two exceptions. The first
1531
- exception is that struct fields are public by default (but the struct itself is
1532
- still private by default), and the remaining exception is that enum variants in
1533
- a ` pub ` enum are the default visibility of the enum container itself.. You are
1534
- allowed to alter this default visibility with the ` pub ` keyword (or ` priv `
1535
- keyword for struct fields and enum variants). When an item is declared as ` pub ` ,
1530
+ By default, everything in rust is * private* , with one exception. Enum variants
1531
+ in a ` pub ` enum are also public by default. You are allowed to alter this
1532
+ default visibility with the ` priv ` keyword. When an item is declared as ` pub ` ,
1536
1533
it can be thought of as being accessible to the outside world. For example:
1537
1534
1538
1535
~~~~
@@ -1542,7 +1539,7 @@ struct Foo;
1542
1539
1543
1540
// Declare a public struct with a private field
1544
1541
pub struct Bar {
1545
- priv field: int
1542
+ field: int
1546
1543
}
1547
1544
1548
1545
// Declare a public enum with public and private variants
@@ -2354,7 +2351,7 @@ The following are examples of structure expressions:
2354
2351
~~~~
2355
2352
# struct Point { x: f64, y: f64 }
2356
2353
# struct TuplePoint(f64, f64);
2357
- # mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } }
2354
+ # mod game { pub struct User<'a> { pub name: &'a str, pub age: uint, pub score: uint } }
2358
2355
# struct Cookie; fn some_fn<T>(t: T) {}
2359
2356
Point {x: 10.0, y: 20.0};
2360
2357
TuplePoint(10.0, 20.0);
@@ -3140,7 +3137,7 @@ The types `char` and `str` hold textual data.
3140
3137
A value of type ` char ` is a [ Unicode scalar value] (
3141
3138
http://www.unicode.org/glossary/#unicode_scalar_value )
3142
3139
(ie. a code point that is not a surrogate),
3143
- represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
3140
+ represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
3144
3141
or 0xE000 to 0x10FFFF range.
3145
3142
A ` [char] ` vector is effectively an UCS-4 / UTF-32 string.
3146
3143
0 commit comments