Skip to content

Commit

Permalink
Making fields in std and extra : private #4386
Browse files Browse the repository at this point in the history
  • Loading branch information
reedlepee123 committed Oct 22, 2013
1 parent dadb6f0 commit 0ada7c7
Show file tree
Hide file tree
Showing 113 changed files with 1,504 additions and 450 deletions.
17 changes: 12 additions & 5 deletions src/libextra/arc.rs
Expand Up @@ -50,6 +50,7 @@ use std::borrow;

/// As sync::condvar, a mechanism for unlock-and-descheduling and signaling.
pub struct Condvar<'self> {
// all were already priv
priv is_mutex: bool,
priv failed: &'self mut bool,
priv cond: &'self sync::Condvar<'self>
Expand Down Expand Up @@ -108,6 +109,7 @@ impl<'self> Condvar<'self> {
****************************************************************************/

/// An atomically reference counted wrapper for shared immutable state.
// all were already priv
pub struct Arc<T> { priv x: UnsafeArc<T> }


Expand Down Expand Up @@ -162,6 +164,7 @@ struct MutexArcInner<T> { priv lock: Mutex, priv failed: bool, priv data: T }

/// An Arc with mutable data protected by a blocking mutex.
#[no_freeze]
//All were already priv
pub struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> }


Expand Down Expand Up @@ -344,6 +347,7 @@ struct RWArcInner<T> { priv lock: RWLock, priv failed: bool, priv data: T }
*/
#[no_freeze]
pub struct RWArc<T> {
// all were already priv
priv x: UnsafeArc<RWArcInner<T>>,
}

Expand Down Expand Up @@ -521,15 +525,18 @@ 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,

/// reedlepee added priv in all the feilds below
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>,
/// reedlepee added priv in all the feilds below
priv data: &'self T,
priv token: sync::RWLockReadMode<'self>,
}

impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {
Expand Down
1 change: 1 addition & 0 deletions src/libextra/arena.rs
Expand Up @@ -62,6 +62,7 @@ pub struct Arena {
// The head is separated out from the list as a unbenchmarked
// microoptimization, to avoid needing to case on the list to
// access the head.
/// no change by reedlepee all were already priv
priv head: Chunk,
priv pod_head: Chunk,
priv chunks: @mut MutList<Chunk>,
Expand Down
7 changes: 4 additions & 3 deletions src/libextra/base64.rs
Expand Up @@ -21,12 +21,13 @@ pub enum CharacterSet {

/// Contains configuration parameters for `to_base64`.
pub struct Config {
/// all were made priv by reedlepee
/// 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
8 changes: 6 additions & 2 deletions src/libextra/bitv.rs
Expand Up @@ -225,10 +225,11 @@ enum Op {Union, Intersect, Assign, Difference}
/// The bitvector type
#[deriving(Clone)]
pub struct Bitv {
/// all were made priv by reedlepee
/// 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 Expand Up @@ -573,6 +574,7 @@ fn iterate_bits(base: uint, bits: uint, f: &fn(uint) -> bool) -> bool {

/// An iterator for `Bitv`.
pub struct BitvIterator<'self> {
/// all were already priv
priv bitv: &'self Bitv,
priv next_idx: uint,
priv end_idx: uint,
Expand Down Expand Up @@ -634,6 +636,7 @@ impl<'self> RandomAccessIterator<bool> for BitvIterator<'self> {
/// as a `uint`.
#[deriving(Clone)]
pub struct BitvSet {
// all were already priv!!
priv size: uint,

// In theory this is a `Bitv` instead of always a `BigBitv`, but knowing that
Expand Down Expand Up @@ -900,6 +903,7 @@ impl BitvSet {
}

pub struct BitvSetIterator<'self> {
// all were already priv
priv set: &'self BitvSet,
priv next_idx: uint
}
Expand Down
1 change: 1 addition & 0 deletions src/libextra/c_vec.rs
Expand Up @@ -44,6 +44,7 @@ use std::util;
* The type representing a foreign chunk of memory
*/
pub struct CVec<T> {
/// No change all were allready priv!!
priv base: *mut T,
priv len: uint,
priv rsrc: @DtorRes,
Expand Down
3 changes: 3 additions & 0 deletions src/libextra/comm.rs
Expand Up @@ -23,6 +23,7 @@ use std::comm;

/// An extension of `pipes::stream` that allows both sending and receiving.
pub struct DuplexStream<T, U> {
// all were already priv
priv chan: Chan<T>,
priv port: Port<U>,
}
Expand Down Expand Up @@ -91,8 +92,10 @@ pub fn DuplexStream<T:Send,U:Send>()
}

/// An extension of `pipes::stream` that provides synchronous message sending.
// all were already priv
pub struct SyncChan<T> { priv duplex_stream: DuplexStream<T, ()> }
/// An extension of `pipes::stream` that acknowledges each message received.
// all were already priv
pub struct SyncPort<T> { priv duplex_stream: DuplexStream<(), T> }

impl<T: Send> GenericChan<T> for SyncChan<T> {
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/crypto/cryptoutil.rs
Expand Up @@ -284,6 +284,7 @@ macro_rules! impl_fixed_buffer( ($name:ident, $size:expr) => (

/// A fixed size buffer of 64 bytes useful for cryptographic operations.
pub struct FixedBuffer64 {
// already priv
priv buffer: [u8, ..64],
priv buffer_idx: uint,
}
Expand All @@ -302,6 +303,7 @@ impl_fixed_buffer!(FixedBuffer64, 64)

/// A fixed size buffer of 128 bytes useful for cryptographic operations.
pub struct FixedBuffer128 {
// already priv
priv buffer: [u8, ..128],
priv buffer_idx: uint,
}
Expand Down
1 change: 1 addition & 0 deletions src/libextra/crypto/md5.rs
Expand Up @@ -159,6 +159,7 @@ static C4: [u32, ..16] = [

/// The MD5 Digest algorithm
pub struct Md5 {
// already priv
priv length_bytes: u64,
priv buffer: FixedBuffer64,
priv state: Md5State,
Expand Down
1 change: 1 addition & 0 deletions src/libextra/crypto/sha1.rs
Expand Up @@ -43,6 +43,7 @@ static K3: u32 = 0xCA62C1D6u32;

/// Structure representing the state of a Sha1 computation
pub struct Sha1 {
// already priv
priv h: [u32, ..DIGEST_BUF_LEN],
priv length_bits: u64,
priv buffer: FixedBuffer64,
Expand Down
6 changes: 6 additions & 0 deletions src/libextra/crypto/sha2.rs
Expand Up @@ -234,6 +234,7 @@ impl Engine512 {

/// The SHA-512 hash algorithm
pub struct Sha512 {
// already priv
priv engine: Engine512
}

Expand Down Expand Up @@ -287,6 +288,7 @@ static H512: [u64, ..8] = [

/// The SHA-384 hash algorithm
pub struct Sha384 {
// already priv
priv engine: Engine512
}

Expand Down Expand Up @@ -338,6 +340,7 @@ static H384: [u64, ..8] = [

/// The SHA-512 hash algorithm with digest truncated to 256 bits
pub struct Sha512Trunc256 {
// already priv
priv engine: Engine512
}

Expand Down Expand Up @@ -387,6 +390,7 @@ static H512_TRUNC_256: [u64, ..8] = [

/// The SHA-512 hash algorithm with digest truncated to 224 bits
pub struct Sha512Trunc224 {
// already priv
priv engine: Engine512
}

Expand Down Expand Up @@ -643,6 +647,7 @@ impl Engine256 {

/// The SHA-256 hash algorithm
pub struct Sha256 {
// already priv
priv engine: Engine256
}

Expand Down Expand Up @@ -696,6 +701,7 @@ static H256: [u32, ..8] = [

/// The SHA-224 hash algorithm
pub struct Sha224 {
// already priv
priv engine: Engine256
}

Expand Down
4 changes: 4 additions & 0 deletions src/libextra/dlist.rs
Expand Up @@ -32,6 +32,7 @@ use container::Deque;

/// A doubly-linked list.
pub struct DList<T> {
// all were already priv
priv length: uint,
priv list_head: Link<T>,
priv list_tail: Rawlink<Node<T>>,
Expand All @@ -49,13 +50,15 @@ struct Node<T> {
/// Double-ended DList iterator
#[deriving(Clone)]
pub struct DListIterator<'self, T> {
// all were already priv
priv head: &'self Link<T>,
priv tail: Rawlink<Node<T>>,
priv nelem: uint,
}

/// Double-ended mutable DList iterator
pub struct MutDListIterator<'self, T> {
// all were already priv
priv list: &'self mut DList<T>,
priv head: Rawlink<Node<T>>,
priv tail: Rawlink<Node<T>>,
Expand All @@ -65,6 +68,7 @@ pub struct MutDListIterator<'self, T> {
/// DList consuming iterator
#[deriving(Clone)]
pub struct MoveIterator<T> {
// all were already priv
priv list: DList<T>
}

Expand Down
12 changes: 9 additions & 3 deletions src/libextra/ebml.rs
Expand Up @@ -30,6 +30,7 @@ struct EbmlState {

#[deriving(Clone)]
pub struct Doc {
// all these should be public
data: @~[u8],
start: uint,
end: uint,
Expand All @@ -50,7 +51,9 @@ impl Doc {
}

pub struct TaggedDoc {
tag: uint,
// was made privv by reedlepee
priv tag: uint,
// should be public
doc: Doc,
}

Expand Down Expand Up @@ -284,6 +287,7 @@ pub mod reader {
pub fn doc_as_i64(d: Doc) -> i64 { doc_as_u64(d) as i64 }

pub struct Decoder {
// all were already priv
priv parent: Doc,
priv pos: uint,
}
Expand Down Expand Up @@ -618,8 +622,10 @@ pub mod writer {

// ebml writing
pub struct Encoder {
writer: @io::Writer,
priv size_positions: ~[uint],
/// should be public!!
writer: @io::Writer,
/// this was already privv!!
priv size_positions: ~[uint],
}

impl Clone for Encoder {
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/enum_set.rs
Expand Up @@ -18,6 +18,7 @@
pub struct EnumSet<E> {
// We must maintain the invariant that no bits are set
// for which no variant exists
// all were already priv
priv bits: uint
}

Expand Down Expand Up @@ -100,6 +101,7 @@ impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {

/// An iterator over an EnumSet
pub struct EnumSetIterator<E> {
// all were already priv
priv index: uint,
priv bits: uint,
}
Expand Down
10 changes: 6 additions & 4 deletions src/libextra/fileinput.rs
Expand Up @@ -109,9 +109,10 @@ file is `stdin`.
*/
#[deriving(Clone)]
pub struct FileInputState {
current_path: Option<Path>,
line_num: uint,
line_num_file: uint
// all were priv made by reedlepee
priv current_path: Option<Path>,
priv line_num: uint,
priv line_num_file: uint
}

impl FileInputState {
Expand Down Expand Up @@ -155,7 +156,8 @@ 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_
/// all were made priv by reedlepee
priv fi: @mut FileInput_
}

impl FileInput {
Expand Down
1 change: 1 addition & 0 deletions src/libextra/future.rs
Expand Up @@ -32,6 +32,7 @@ use std::util::replace;

/// A type encapsulating the result of a computation which may not be complete
pub struct Future<A> {
// all were already privv!!
priv state: FutureState<A>,
}

Expand Down
15 changes: 10 additions & 5 deletions src/libextra/getopts.rs
Expand Up @@ -112,14 +112,16 @@ pub enum Occur {
/// A description of a possible option.
#[deriving(Clone, Eq)]
pub struct Opt {

/// reedlepee added priv infront of them!!
/// Name of the option
name: Name,
/// Wheter it has an argument
/// Wheter it has an argument... should be public!!
hasarg: HasArg,
/// How often it can occur
/// How often it can occur... should be private !!
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 @@ -133,11 +135,14 @@ enum Optval {
/// of matches and a vector of free strings.
#[deriving(Clone, Eq)]
pub struct Matches {

/// reedlepee added priv infront of all
/// Options that matched
opts: ~[Opt],
priv opts: ~[Opt],
/// Values of the Options that matched
vals: ~[~[Optval]],
priv vals: ~[~[Optval]],
/// Free string fragments
// public
free: ~[~str]
}

Expand Down

0 comments on commit 0ada7c7

Please sign in to comment.