about summary refs log tree commit diff
path: root/src/libstd/fmt/parse.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-03-31 15:51:33 -0700
committerbors <bors@rust-lang.org>2014-03-31 15:51:33 -0700
commitb8ef9fd9c9f642ce7b8aed82782a1ed745d08d64 (patch)
tree1e66451d207e19694d62608a8e1724c71796dc00 /src/libstd/fmt/parse.rs
parenta7e057d402a345f547e67a326871621472d04035 (diff)
parent37a3131640d0fa2633aa26db7f849d110250ce51 (diff)
downloadrust-b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64.tar.gz
rust-b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64.zip
auto merge of #13184 : alexcrichton/rust/priv-fields, r=brson
This is an implementation of a portion of [RFC #4](https://github.com/rust-lang/rfcs/blob/master/active/0004-private-fields.md). This PR makes named struct fields private by default (as opposed to inherited by default).

The only real meaty change is the first commit to `rustc`, all other commits are just fallout of that change.

Summary of changes made:

* Named fields are private by default *everywhere*
* The `priv` keyword is now default-deny on named fields (done in a "lint" pass in privacy)

Changes yet to be done (before the RFC is closed)

* Change tuple structs to have private fields by default
* Remove `priv` enum variants
* Make `priv` a reserved keyword
Diffstat (limited to 'src/libstd/fmt/parse.rs')
-rw-r--r--src/libstd/fmt/parse.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libstd/fmt/parse.rs b/src/libstd/fmt/parse.rs
index 384e2ff2380..4752f3a75f4 100644
--- a/src/libstd/fmt/parse.rs
+++ b/src/libstd/fmt/parse.rs
@@ -37,30 +37,30 @@ pub enum Piece<'a> {
 #[deriving(Eq)]
 pub struct Argument<'a> {
     /// Where to find this argument
-    position: Position<'a>,
+    pub position: Position<'a>,
     /// How to format the argument
-    format: FormatSpec<'a>,
+    pub format: FormatSpec<'a>,
     /// If not `None`, what method to invoke on the argument
-    method: Option<~Method<'a>>
+    pub method: Option<~Method<'a>>
 }
 
 /// Specification for the formatting of an argument in the format string.
 #[deriving(Eq)]
 pub struct FormatSpec<'a> {
     /// Optionally specified character to fill alignment with
-    fill: Option<char>,
+    pub fill: Option<char>,
     /// Optionally specified alignment
-    align: Alignment,
+    pub align: Alignment,
     /// Packed version of various flags provided
-    flags: uint,
+    pub flags: uint,
     /// The integer precision to use
-    precision: Count<'a>,
+    pub precision: Count<'a>,
     /// The string width requested for the resulting format
-    width: Count<'a>,
+    pub width: Count<'a>,
     /// The descriptor string representing the name of the format desired for
     /// this argument, this can be empty or any number of characters, although
     /// it is required to be one word.
-    ty: &'a str
+    pub ty: &'a str
 }
 
 /// Enum describing where an argument for a format can be located.
@@ -154,9 +154,9 @@ pub enum PluralSelector {
 pub struct PluralArm<'a> {
     /// A selector can either be specified by a keyword or with an integer
     /// literal.
-    selector: PluralSelector,
+    pub selector: PluralSelector,
     /// Array of pieces which are the format of this arm
-    result: ~[Piece<'a>],
+    pub result: ~[Piece<'a>],
 }
 
 /// Enum of the 5 CLDR plural keywords. There is one more, "other", but that
@@ -182,9 +182,9 @@ pub enum PluralKeyword {
 #[deriving(Eq)]
 pub struct SelectArm<'a> {
     /// String selector which guards this arm
-    selector: &'a str,
+    pub selector: &'a str,
     /// Array of pieces which are the format of this arm
-    result: ~[Piece<'a>],
+    pub result: ~[Piece<'a>],
 }
 
 /// The parser structure for interpreting the input format string. This is
@@ -194,11 +194,11 @@ pub struct SelectArm<'a> {
 /// This is a recursive-descent parser for the sake of simplicity, and if
 /// necessary there's probably lots of room for improvement performance-wise.
 pub struct Parser<'a> {
-    priv input: &'a str,
-    priv cur: str::CharOffsets<'a>,
-    priv depth: uint,
+    input: &'a str,
+    cur: str::CharOffsets<'a>,
+    depth: uint,
     /// Error messages accumulated during parsing
-    errors: ~[~str],
+    pub errors: ~[~str],
 }
 
 impl<'a> Iterator<Piece<'a>> for Parser<'a> {