Skip to content

Commit

Permalink
auto merge of #9969 : reedlepee123/rust/priv_fields, r=bstrie
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Oct 22, 2013
2 parents b477f7a + 7e6f5bb commit a7453ad
Show file tree
Hide file tree
Showing 53 changed files with 216 additions and 214 deletions.
10 changes: 5 additions & 5 deletions src/libextra/arc.rs
Expand Up @@ -521,15 +521,15 @@ fn borrow_rwlock<T:Freeze + Send>(state: *mut RWArcInner<T>) -> *RWLock {

/// The "write permission" token used for RWArc.write_downgrade().
pub struct RWWriteMode<'self, T> {
data: &'self mut T,
token: sync::RWLockWriteMode<'self>,
poison: PoisonOnFail,
priv data: &'self mut T,
priv token: sync::RWLockWriteMode<'self>,
priv poison: PoisonOnFail,
}

/// The "read permission" token used for RWArc.write_downgrade().
pub struct RWReadMode<'self, T> {
data: &'self T,
token: sync::RWLockReadMode<'self>,
priv data: &'self T,
priv token: sync::RWLockReadMode<'self>,
}

impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/base64.rs
Expand Up @@ -22,11 +22,11 @@ pub enum CharacterSet {
/// Contains configuration parameters for `to_base64`.
pub struct Config {
/// Character set to use
char_set: CharacterSet,
priv char_set: CharacterSet,
/// True to pad output with `=` characters
pad: bool,
priv pad: bool,
/// `Some(len)` to wrap lines at `len`, `None` to disable line wrapping
line_length: Option<uint>
priv line_length: Option<uint>
}

/// Configuration for RFC 4648 standard base64 encoding
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/bitv.rs
Expand Up @@ -226,9 +226,9 @@ enum Op {Union, Intersect, Assign, Difference}
#[deriving(Clone)]
pub struct Bitv {
/// Internal representation of the bit vector (small or large)
rep: BitvVariant,
priv rep: BitvVariant,
/// The number of valid bits in the internal representation
nbits: uint
priv nbits: uint
}

fn die() -> ! {
Expand Down
2 changes: 1 addition & 1 deletion src/libextra/ebml.rs
Expand Up @@ -50,7 +50,7 @@ impl Doc {
}

pub struct TaggedDoc {
tag: uint,
priv tag: uint,
doc: Doc,
}

Expand Down
2 changes: 1 addition & 1 deletion src/libextra/fileinput.rs
Expand Up @@ -155,7 +155,7 @@ struct FileInput_ {
// "self.fi" -> "self." and renaming FileInput_. Documentation above
// will likely have to be updated to use `let mut in = ...`.
pub struct FileInput {
fi: @mut FileInput_
priv fi: @mut FileInput_
}

impl FileInput {
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/getopts.rs
Expand Up @@ -119,7 +119,7 @@ pub struct Opt {
/// How often it can occur
occur: Occur,
/// Which options it aliases
aliases: ~[Opt],
priv aliases: ~[Opt],
}

/// Describes wether an option is given at all or has a value.
Expand All @@ -134,9 +134,9 @@ enum Optval {
#[deriving(Clone, Eq)]
pub struct Matches {
/// Options that matched
opts: ~[Opt],
priv opts: ~[Opt],
/// Values of the Options that matched
vals: ~[~[Optval]],
priv vals: ~[~[Optval]],
/// Free string fragments
free: ~[~str]
}
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/glob.rs
Expand Up @@ -480,21 +480,21 @@ pub struct MatchOptions {
* currently only considers upper/lower case relationships between ASCII characters,
* but in future this might be extended to work with Unicode.
*/
case_sensitive: bool,
priv case_sensitive: bool,

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

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

impl MatchOptions {
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/io_util.rs
Expand Up @@ -17,9 +17,9 @@ use std::cast;
/// An implementation of the io::Reader interface which reads a buffer of bytes
pub struct BufReader {
/// The buffer of bytes to read
buf: ~[u8],
priv buf: ~[u8],
/// The current position in the buffer of bytes
pos: @mut uint
priv pos: @mut uint
}

impl BufReader {
Expand Down
6 changes: 3 additions & 3 deletions src/libextra/json.rs
Expand Up @@ -49,11 +49,11 @@ pub type Object = TreeMap<~str, Json>;
/// returned
pub struct Error {
/// The line number at which the error occurred
line: uint,
priv line: uint,
/// The column number at which the error occurred
col: uint,
priv col: uint,
/// A message describing the type of the error
msg: @~str,
priv msg: @~str,
}

fn escape_str(s: &str) -> ~str {
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/num/rational.rs
Expand Up @@ -20,8 +20,8 @@ use super::bigint::BigInt;
#[deriving(Clone)]
#[allow(missing_doc)]
pub struct Ratio<T> {
numer: T,
denom: T
priv numer: T,
priv denom: T
}

/// Alias for a `Ratio` of machine-sized integers.
Expand Down
10 changes: 5 additions & 5 deletions src/libextra/semver.rs
Expand Up @@ -71,17 +71,17 @@ impl ToStr for Identifier {
#[deriving(Clone, Eq)]
pub struct Version {
/// The major version, to be incremented on incompatible changes.
major: uint,
priv major: uint,
/// The minor version, to be incremented when functionality is added in a
/// backwards-compatible manner.
minor: uint,
priv minor: uint,
/// The patch version, to be incremented when backwards-compatible bug
/// fixes are made.
patch: uint,
priv patch: uint,
/// The pre-release version identifier, if one exists.
pre: ~[Identifier],
priv pre: ~[Identifier],
/// The build metadata, ignored when determining version precedence.
build: ~[Identifier],
priv build: ~[Identifier],
}

impl ToStr for Version {
Expand Down
19 changes: 12 additions & 7 deletions src/libextra/stats.rs
Expand Up @@ -105,18 +105,23 @@ pub trait Stats {
#[deriving(Clone, Eq)]
#[allow(missing_doc)]
pub struct Summary {
sum: f64,
priv sum: f64,
// public
min: f64,
// public
max: f64,
mean: f64,
priv mean: f64,
// public
median: f64,
var: f64,
std_dev: f64,
std_dev_pct: f64,
priv var: f64,
priv std_dev: f64,
priv std_dev_pct: f64,
// public
median_abs_dev: f64,
// public
median_abs_dev_pct: f64,
quartiles: (f64,f64,f64),
iqr: f64,
priv quartiles: (f64,f64,f64),
priv iqr: f64,
}

impl Summary {
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/sync.rs
Expand Up @@ -376,8 +376,8 @@ impl Semaphore {
* A task which fails while holding a mutex will unlock the mutex as it
* unwinds.
*/
pub struct Mutex { priv sem: Sem<~[WaitQueue]> }

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

/// The "write permission" token used for rwlock.write_downgrade().
pub struct RWLockWriteMode<'self> { priv lock: &'self RWLock, priv token: NonCopyable }

pub struct RWLockWriteMode<'self> { priv lock: &'self RWLock, priv token: NonCopyable }
/// The "read permission" token used for rwlock.write_downgrade().
pub struct RWLockReadMode<'self> { priv lock: &'self RWLock,
priv token: NonCopyable }
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/task_pool.rs
Expand Up @@ -28,8 +28,8 @@ enum Msg<T> {
}

pub struct TaskPool<T> {
channels: ~[Chan<Msg<T>>],
next_index: uint,
priv channels: ~[Chan<Msg<T>>],
priv next_index: uint,
}

#[unsafe_destructor]
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/term.rs
Expand Up @@ -95,14 +95,14 @@ fn cap_for_attr(attr: attr::Attr) -> &'static str {

#[cfg(not(target_os = "win32"))]
pub struct Terminal {
num_colors: u16,
priv num_colors: u16,
priv out: @io::Writer,
priv ti: ~TermInfo
}

#[cfg(target_os = "win32")]
pub struct Terminal {
num_colors: u16,
priv num_colors: u16,
priv out: @io::Writer,
}

Expand Down
4 changes: 2 additions & 2 deletions src/libextra/terminfo/parm.rs
Expand Up @@ -48,9 +48,9 @@ pub enum Param {
/// Container for static and dynamic variable arrays
pub struct Variables {
/// Static variables A-Z
sta: [Param, ..26],
priv sta: [Param, ..26],
/// Dynamic variables a-z
dyn: [Param, ..26]
priv dyn: [Param, ..26]
}

impl Variables {
Expand Down
4 changes: 2 additions & 2 deletions src/libextra/terminfo/terminfo.rs
Expand Up @@ -15,9 +15,9 @@ use std::hashmap::HashMap;
/// A parsed terminfo entry.
pub struct TermInfo {
/// Names for the terminal
names: ~[~str],
priv names: ~[~str],
/// Map of capability name to boolean value
bools: HashMap<~str, bool>,
priv bools: HashMap<~str, bool>,
/// Map of capability name to numeric value
numbers: HashMap<~str, u16>,
/// Map of capability name to raw (unexpanded) string
Expand Down
14 changes: 7 additions & 7 deletions src/libextra/test.rs
Expand Up @@ -102,9 +102,9 @@ impl TestFn {

// Structure passed to BenchFns
pub struct BenchHarness {
iterations: u64,
ns_start: u64,
ns_end: u64,
priv iterations: u64,
priv ns_start: u64,
priv ns_end: u64,
bytes: u64
}

Expand All @@ -124,8 +124,8 @@ pub struct TestDescAndFn {

#[deriving(Clone, Encodable, Decodable, Eq)]
pub struct Metric {
value: f64,
noise: f64
priv value: f64,
priv noise: f64
}

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

#[deriving(Clone, Eq)]
pub struct BenchSamples {
ns_iter_summ: stats::Summary,
mb_s: uint
priv ns_iter_summ: stats::Summary,
priv mb_s: uint
}

#[deriving(Clone, Eq)]
Expand Down
29 changes: 15 additions & 14 deletions src/libextra/time.rs
Expand Up @@ -31,9 +31,10 @@ pub mod rustrt {
}

/// A record specifying a time value in seconds and nanoseconds.
#[deriving(Clone, DeepClone, Eq, Encodable, Decodable)]
pub struct Timespec { sec: i64, nsec: i32 }


#[deriving(Clone, DeepClone, Eq, Encodable, Decodable)]
pub struct Timespec { priv sec: i64, priv nsec: i32 }
/*
* Timespec assumes that pre-epoch Timespecs have negative sec and positive
* nsec fields. Darwin's and Linux's struct timespec functions handle pre-
Expand Down Expand Up @@ -105,18 +106,18 @@ pub fn tzset() {

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

pub fn empty_tm() -> Tm {
Expand Down

0 comments on commit a7453ad

Please sign in to comment.