Skip to content

Commit a7453ad

Browse files
committed
auto merge of #9969 : reedlepee123/rust/priv_fields, r=bstrie
2 parents b477f7a + 7e6f5bb commit a7453ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+216
-214
lines changed

src/libextra/arc.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,15 @@ fn borrow_rwlock<T:Freeze + Send>(state: *mut RWArcInner<T>) -> *RWLock {
521521

522522
/// The "write permission" token used for RWArc.write_downgrade().
523523
pub struct RWWriteMode<'self, T> {
524-
data: &'self mut T,
525-
token: sync::RWLockWriteMode<'self>,
526-
poison: PoisonOnFail,
524+
priv data: &'self mut T,
525+
priv token: sync::RWLockWriteMode<'self>,
526+
priv poison: PoisonOnFail,
527527
}
528528

529529
/// The "read permission" token used for RWArc.write_downgrade().
530530
pub struct RWReadMode<'self, T> {
531-
data: &'self T,
532-
token: sync::RWLockReadMode<'self>,
531+
priv data: &'self T,
532+
priv token: sync::RWLockReadMode<'self>,
533533
}
534534

535535
impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {

src/libextra/base64.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub enum CharacterSet {
2222
/// Contains configuration parameters for `to_base64`.
2323
pub struct Config {
2424
/// Character set to use
25-
char_set: CharacterSet,
25+
priv char_set: CharacterSet,
2626
/// True to pad output with `=` characters
27-
pad: bool,
27+
priv pad: bool,
2828
/// `Some(len)` to wrap lines at `len`, `None` to disable line wrapping
29-
line_length: Option<uint>
29+
priv line_length: Option<uint>
3030
}
3131

3232
/// Configuration for RFC 4648 standard base64 encoding

src/libextra/bitv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ enum Op {Union, Intersect, Assign, Difference}
226226
#[deriving(Clone)]
227227
pub struct Bitv {
228228
/// Internal representation of the bit vector (small or large)
229-
rep: BitvVariant,
229+
priv rep: BitvVariant,
230230
/// The number of valid bits in the internal representation
231-
nbits: uint
231+
priv nbits: uint
232232
}
233233

234234
fn die() -> ! {

src/libextra/ebml.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Doc {
5050
}
5151

5252
pub struct TaggedDoc {
53-
tag: uint,
53+
priv tag: uint,
5454
doc: Doc,
5555
}
5656

src/libextra/fileinput.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ struct FileInput_ {
155155
// "self.fi" -> "self." and renaming FileInput_. Documentation above
156156
// will likely have to be updated to use `let mut in = ...`.
157157
pub struct FileInput {
158-
fi: @mut FileInput_
158+
priv fi: @mut FileInput_
159159
}
160160

161161
impl FileInput {

src/libextra/getopts.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub struct Opt {
119119
/// How often it can occur
120120
occur: Occur,
121121
/// Which options it aliases
122-
aliases: ~[Opt],
122+
priv aliases: ~[Opt],
123123
}
124124

125125
/// Describes wether an option is given at all or has a value.
@@ -134,9 +134,9 @@ enum Optval {
134134
#[deriving(Clone, Eq)]
135135
pub struct Matches {
136136
/// Options that matched
137-
opts: ~[Opt],
137+
priv opts: ~[Opt],
138138
/// Values of the Options that matched
139-
vals: ~[~[Optval]],
139+
priv vals: ~[~[Optval]],
140140
/// Free string fragments
141141
free: ~[~str]
142142
}

src/libextra/glob.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -480,21 +480,21 @@ pub struct MatchOptions {
480480
* currently only considers upper/lower case relationships between ASCII characters,
481481
* but in future this might be extended to work with Unicode.
482482
*/
483-
case_sensitive: bool,
483+
priv case_sensitive: bool,
484484

485485
/**
486486
* If this is true then path-component separator characters (e.g. `/` on Posix)
487487
* must be matched by a literal `/`, rather than by `*` or `?` or `[...]`
488488
*/
489-
require_literal_separator: bool,
489+
priv require_literal_separator: bool,
490490

491491
/**
492492
* If this is true then paths that contain components that start with a `.` will
493493
* not match unless the `.` appears literally in the pattern: `*`, `?` or `[...]`
494494
* will not match. This is useful because such files are conventionally considered
495495
* hidden on Unix systems and it might be desirable to skip them when listing files.
496496
*/
497-
require_literal_leading_dot: bool
497+
priv require_literal_leading_dot: bool
498498
}
499499

500500
impl MatchOptions {

src/libextra/io_util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use std::cast;
1717
/// An implementation of the io::Reader interface which reads a buffer of bytes
1818
pub struct BufReader {
1919
/// The buffer of bytes to read
20-
buf: ~[u8],
20+
priv buf: ~[u8],
2121
/// The current position in the buffer of bytes
22-
pos: @mut uint
22+
priv pos: @mut uint
2323
}
2424

2525
impl BufReader {

src/libextra/json.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ pub type Object = TreeMap<~str, Json>;
4949
/// returned
5050
pub struct Error {
5151
/// The line number at which the error occurred
52-
line: uint,
52+
priv line: uint,
5353
/// The column number at which the error occurred
54-
col: uint,
54+
priv col: uint,
5555
/// A message describing the type of the error
56-
msg: @~str,
56+
priv msg: @~str,
5757
}
5858

5959
fn escape_str(s: &str) -> ~str {

src/libextra/num/rational.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use super::bigint::BigInt;
2020
#[deriving(Clone)]
2121
#[allow(missing_doc)]
2222
pub struct Ratio<T> {
23-
numer: T,
24-
denom: T
23+
priv numer: T,
24+
priv denom: T
2525
}
2626

2727
/// Alias for a `Ratio` of machine-sized integers.

src/libextra/semver.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ impl ToStr for Identifier {
7171
#[deriving(Clone, Eq)]
7272
pub struct Version {
7373
/// The major version, to be incremented on incompatible changes.
74-
major: uint,
74+
priv major: uint,
7575
/// The minor version, to be incremented when functionality is added in a
7676
/// backwards-compatible manner.
77-
minor: uint,
77+
priv minor: uint,
7878
/// The patch version, to be incremented when backwards-compatible bug
7979
/// fixes are made.
80-
patch: uint,
80+
priv patch: uint,
8181
/// The pre-release version identifier, if one exists.
82-
pre: ~[Identifier],
82+
priv pre: ~[Identifier],
8383
/// The build metadata, ignored when determining version precedence.
84-
build: ~[Identifier],
84+
priv build: ~[Identifier],
8585
}
8686

8787
impl ToStr for Version {

src/libextra/stats.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,23 @@ pub trait Stats {
105105
#[deriving(Clone, Eq)]
106106
#[allow(missing_doc)]
107107
pub struct Summary {
108-
sum: f64,
108+
priv sum: f64,
109+
// public
109110
min: f64,
111+
// public
110112
max: f64,
111-
mean: f64,
113+
priv mean: f64,
114+
// public
112115
median: f64,
113-
var: f64,
114-
std_dev: f64,
115-
std_dev_pct: f64,
116+
priv var: f64,
117+
priv std_dev: f64,
118+
priv std_dev_pct: f64,
119+
// public
116120
median_abs_dev: f64,
121+
// public
117122
median_abs_dev_pct: f64,
118-
quartiles: (f64,f64,f64),
119-
iqr: f64,
123+
priv quartiles: (f64,f64,f64),
124+
priv iqr: f64,
120125
}
121126

122127
impl Summary {

src/libextra/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ impl Semaphore {
376376
* A task which fails while holding a mutex will unlock the mutex as it
377377
* unwinds.
378378
*/
379-
pub struct Mutex { priv sem: Sem<~[WaitQueue]> }
380379

380+
pub struct Mutex { priv sem: Sem<~[WaitQueue]> }
381381
impl Clone for Mutex {
382382
/// Create a new handle to the mutex.
383383
fn clone(&self) -> Mutex { Mutex { sem: Sem((*self.sem).clone()) } }
@@ -663,8 +663,8 @@ impl RWLock {
663663
}
664664

665665
/// The "write permission" token used for rwlock.write_downgrade().
666-
pub struct RWLockWriteMode<'self> { priv lock: &'self RWLock, priv token: NonCopyable }
667666
667+
pub struct RWLockWriteMode<'self> { priv lock: &'self RWLock, priv token: NonCopyable }
668668
/// The "read permission" token used for rwlock.write_downgrade().
669669
pub struct RWLockReadMode<'self> { priv lock: &'self RWLock,
670670
priv token: NonCopyable }

src/libextra/task_pool.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ enum Msg<T> {
2828
}
2929

3030
pub struct TaskPool<T> {
31-
channels: ~[Chan<Msg<T>>],
32-
next_index: uint,
31+
priv channels: ~[Chan<Msg<T>>],
32+
priv next_index: uint,
3333
}
3434

3535
#[unsafe_destructor]

src/libextra/term.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ fn cap_for_attr(attr: attr::Attr) -> &'static str {
9595

9696
#[cfg(not(target_os = "win32"))]
9797
pub struct Terminal {
98-
num_colors: u16,
98+
priv num_colors: u16,
9999
priv out: @io::Writer,
100100
priv ti: ~TermInfo
101101
}
102102

103103
#[cfg(target_os = "win32")]
104104
pub struct Terminal {
105-
num_colors: u16,
105+
priv num_colors: u16,
106106
priv out: @io::Writer,
107107
}
108108

src/libextra/terminfo/parm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ pub enum Param {
4848
/// Container for static and dynamic variable arrays
4949
pub struct Variables {
5050
/// Static variables A-Z
51-
sta: [Param, ..26],
51+
priv sta: [Param, ..26],
5252
/// Dynamic variables a-z
53-
dyn: [Param, ..26]
53+
priv dyn: [Param, ..26]
5454
}
5555

5656
impl Variables {

src/libextra/terminfo/terminfo.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use std::hashmap::HashMap;
1515
/// A parsed terminfo entry.
1616
pub struct TermInfo {
1717
/// Names for the terminal
18-
names: ~[~str],
18+
priv names: ~[~str],
1919
/// Map of capability name to boolean value
20-
bools: HashMap<~str, bool>,
20+
priv bools: HashMap<~str, bool>,
2121
/// Map of capability name to numeric value
2222
numbers: HashMap<~str, u16>,
2323
/// Map of capability name to raw (unexpanded) string

src/libextra/test.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ impl TestFn {
102102

103103
// Structure passed to BenchFns
104104
pub struct BenchHarness {
105-
iterations: u64,
106-
ns_start: u64,
107-
ns_end: u64,
105+
priv iterations: u64,
106+
priv ns_start: u64,
107+
priv ns_end: u64,
108108
bytes: u64
109109
}
110110

@@ -124,8 +124,8 @@ pub struct TestDescAndFn {
124124

125125
#[deriving(Clone, Encodable, Decodable, Eq)]
126126
pub struct Metric {
127-
value: f64,
128-
noise: f64
127+
priv value: f64,
128+
priv noise: f64
129129
}
130130

131131
#[deriving(Eq)]
@@ -322,8 +322,8 @@ pub fn opt_shard(maybestr: Option<~str>) -> Option<(uint,uint)> {
322322

323323
#[deriving(Clone, Eq)]
324324
pub struct BenchSamples {
325-
ns_iter_summ: stats::Summary,
326-
mb_s: uint
325+
priv ns_iter_summ: stats::Summary,
326+
priv mb_s: uint
327327
}
328328

329329
#[deriving(Clone, Eq)]

src/libextra/time.rs

+15-14
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ pub mod rustrt {
3131
}
3232

3333
/// A record specifying a time value in seconds and nanoseconds.
34-
#[deriving(Clone, DeepClone, Eq, Encodable, Decodable)]
35-
pub struct Timespec { sec: i64, nsec: i32 }
3634
35+
36+
#[deriving(Clone, DeepClone, Eq, Encodable, Decodable)]
37+
pub struct Timespec { priv sec: i64, priv nsec: i32 }
3738
/*
3839
* Timespec assumes that pre-epoch Timespecs have negative sec and positive
3940
* nsec fields. Darwin's and Linux's struct timespec functions handle pre-
@@ -105,18 +106,18 @@ pub fn tzset() {
105106

106107
#[deriving(Clone, DeepClone, Eq, Encodable, Decodable)]
107108
pub struct Tm {
108-
tm_sec: i32, // seconds after the minute ~[0-60]
109-
tm_min: i32, // minutes after the hour ~[0-59]
110-
tm_hour: i32, // hours after midnight ~[0-23]
111-
tm_mday: i32, // days of the month ~[1-31]
112-
tm_mon: i32, // months since January ~[0-11]
113-
tm_year: i32, // years since 1900
114-
tm_wday: i32, // days since Sunday ~[0-6]
115-
tm_yday: i32, // days since January 1 ~[0-365]
116-
tm_isdst: i32, // Daylight Savings Time flag
117-
tm_gmtoff: i32, // offset from UTC in seconds
118-
tm_zone: ~str, // timezone abbreviation
119-
tm_nsec: i32, // nanoseconds
109+
priv tm_sec: i32, // seconds after the minute ~[0-60]
110+
priv tm_min: i32, // minutes after the hour ~[0-59]
111+
priv tm_hour: i32, // hours after midnight ~[0-23]
112+
priv tm_mday: i32, // days of the month ~[1-31]
113+
priv tm_mon: i32, // months since January ~[0-11]
114+
priv tm_year: i32, // years since 1900
115+
priv tm_wday: i32, // days since Sunday ~[0-6]
116+
priv tm_yday: i32, // days since January 1 ~[0-365]
117+
priv tm_isdst: i32, // Daylight Savings Time flag
118+
priv tm_gmtoff: i32, // offset from UTC in seconds
119+
priv tm_zone: ~str, // timezone abbreviation
120+
priv tm_nsec: i32, // nanoseconds
120121
}
121122

122123
pub fn empty_tm() -> Tm {

0 commit comments

Comments
 (0)