std: Switch field privacy as necessary
This commit is contained in:
parent
f2a5c7a179
commit
9a3d04ae76
|
@ -25,7 +25,7 @@ use option::{Option, Some, None};
|
||||||
|
|
||||||
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
|
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
|
||||||
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)]
|
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)]
|
||||||
pub struct Ascii { priv chr: u8 }
|
pub struct Ascii { chr: u8 }
|
||||||
|
|
||||||
impl Ascii {
|
impl Ascii {
|
||||||
/// Converts an ascii character into a `u8`.
|
/// Converts an ascii character into a `u8`.
|
||||||
|
|
|
@ -86,8 +86,8 @@ use raw::Slice;
|
||||||
/// This structure wraps a `*libc::c_char`, and will automatically free the
|
/// This structure wraps a `*libc::c_char`, and will automatically free the
|
||||||
/// memory it is pointing to when it goes out of scope.
|
/// memory it is pointing to when it goes out of scope.
|
||||||
pub struct CString {
|
pub struct CString {
|
||||||
priv buf: *libc::c_char,
|
buf: *libc::c_char,
|
||||||
priv owns_buffer_: bool,
|
owns_buffer_: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clone for CString {
|
impl Clone for CString {
|
||||||
|
@ -373,8 +373,8 @@ fn check_for_null(v: &[u8], buf: *mut libc::c_char) {
|
||||||
///
|
///
|
||||||
/// Use with the `std::iter` module.
|
/// Use with the `std::iter` module.
|
||||||
pub struct CChars<'a> {
|
pub struct CChars<'a> {
|
||||||
priv ptr: *libc::c_char,
|
ptr: *libc::c_char,
|
||||||
priv marker: marker::ContravariantLifetime<'a>,
|
marker: marker::ContravariantLifetime<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator<libc::c_char> for CChars<'a> {
|
impl<'a> Iterator<libc::c_char> for CChars<'a> {
|
||||||
|
|
|
@ -44,9 +44,9 @@ use raw;
|
||||||
|
|
||||||
/// The type representing a foreign chunk of memory
|
/// The type representing a foreign chunk of memory
|
||||||
pub struct CVec<T> {
|
pub struct CVec<T> {
|
||||||
priv base: *mut T,
|
base: *mut T,
|
||||||
priv len: uint,
|
len: uint,
|
||||||
priv dtor: Option<proc:Send()>,
|
dtor: Option<proc:Send()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
|
|
@ -21,8 +21,8 @@ use ty::Unsafe;
|
||||||
|
|
||||||
/// A mutable memory location that admits only `Copy` data.
|
/// A mutable memory location that admits only `Copy` data.
|
||||||
pub struct Cell<T> {
|
pub struct Cell<T> {
|
||||||
priv value: Unsafe<T>,
|
value: Unsafe<T>,
|
||||||
priv noshare: marker::NoShare,
|
noshare: marker::NoShare,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy> Cell<T> {
|
impl<T:Copy> Cell<T> {
|
||||||
|
@ -69,10 +69,10 @@ impl<T: fmt::Show> fmt::Show for Cell<T> {
|
||||||
|
|
||||||
/// A mutable memory location with dynamically checked borrow rules
|
/// A mutable memory location with dynamically checked borrow rules
|
||||||
pub struct RefCell<T> {
|
pub struct RefCell<T> {
|
||||||
priv value: Unsafe<T>,
|
value: Unsafe<T>,
|
||||||
priv borrow: BorrowFlag,
|
borrow: BorrowFlag,
|
||||||
priv nocopy: marker::NoCopy,
|
nocopy: marker::NoCopy,
|
||||||
priv noshare: marker::NoShare,
|
noshare: marker::NoShare,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Values [1, MAX-1] represent the number of `Ref` active
|
// Values [1, MAX-1] represent the number of `Ref` active
|
||||||
|
@ -202,7 +202,7 @@ impl<T: Eq> Eq for RefCell<T> {
|
||||||
|
|
||||||
/// Wraps a borrowed reference to a value in a `RefCell` box.
|
/// Wraps a borrowed reference to a value in a `RefCell` box.
|
||||||
pub struct Ref<'b, T> {
|
pub struct Ref<'b, T> {
|
||||||
priv parent: &'b RefCell<T>
|
parent: &'b RefCell<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
@ -222,7 +222,7 @@ impl<'b, T> Deref<T> for Ref<'b, T> {
|
||||||
|
|
||||||
/// Wraps a mutable borrowed reference to a value in a `RefCell` box.
|
/// Wraps a mutable borrowed reference to a value in a `RefCell` box.
|
||||||
pub struct RefMut<'b, T> {
|
pub struct RefMut<'b, T> {
|
||||||
priv parent: &'b mut RefCell<T>
|
parent: &'b mut RefCell<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
|
|
@ -289,34 +289,34 @@ static RESCHED_FREQ: int = 256;
|
||||||
/// The receiving-half of Rust's channel type. This half can only be owned by
|
/// The receiving-half of Rust's channel type. This half can only be owned by
|
||||||
/// one task
|
/// one task
|
||||||
pub struct Receiver<T> {
|
pub struct Receiver<T> {
|
||||||
priv inner: Flavor<T>,
|
inner: Flavor<T>,
|
||||||
priv receives: Cell<uint>,
|
receives: Cell<uint>,
|
||||||
// can't share in an arc
|
// can't share in an arc
|
||||||
priv marker: marker::NoShare,
|
marker: marker::NoShare,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator over messages on a receiver, this iterator will block
|
/// An iterator over messages on a receiver, this iterator will block
|
||||||
/// whenever `next` is called, waiting for a new message, and `None` will be
|
/// whenever `next` is called, waiting for a new message, and `None` will be
|
||||||
/// returned when the corresponding channel has hung up.
|
/// returned when the corresponding channel has hung up.
|
||||||
pub struct Messages<'a, T> {
|
pub struct Messages<'a, T> {
|
||||||
priv rx: &'a Receiver<T>
|
rx: &'a Receiver<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The sending-half of Rust's asynchronous channel type. This half can only be
|
/// The sending-half of Rust's asynchronous channel type. This half can only be
|
||||||
/// owned by one task, but it can be cloned to send to other tasks.
|
/// owned by one task, but it can be cloned to send to other tasks.
|
||||||
pub struct Sender<T> {
|
pub struct Sender<T> {
|
||||||
priv inner: Flavor<T>,
|
inner: Flavor<T>,
|
||||||
priv sends: Cell<uint>,
|
sends: Cell<uint>,
|
||||||
// can't share in an arc
|
// can't share in an arc
|
||||||
priv marker: marker::NoShare,
|
marker: marker::NoShare,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The sending-half of Rust's synchronous channel type. This half can only be
|
/// The sending-half of Rust's synchronous channel type. This half can only be
|
||||||
/// owned by one task, but it can be cloned to send to other tasks.
|
/// owned by one task, but it can be cloned to send to other tasks.
|
||||||
pub struct SyncSender<T> {
|
pub struct SyncSender<T> {
|
||||||
priv inner: UnsafeArc<sync::Packet<T>>,
|
inner: UnsafeArc<sync::Packet<T>>,
|
||||||
// can't share in an arc
|
// can't share in an arc
|
||||||
priv marker: marker::NoShare,
|
marker: marker::NoShare,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This enumeration is the list of the possible reasons that try_recv could not
|
/// This enumeration is the list of the possible reasons that try_recv could not
|
||||||
|
|
|
@ -62,10 +62,10 @@ use uint;
|
||||||
/// The "receiver set" of the select interface. This structure is used to manage
|
/// The "receiver set" of the select interface. This structure is used to manage
|
||||||
/// a set of receivers which are being selected over.
|
/// a set of receivers which are being selected over.
|
||||||
pub struct Select {
|
pub struct Select {
|
||||||
priv head: *mut Handle<'static, ()>,
|
head: *mut Handle<'static, ()>,
|
||||||
priv tail: *mut Handle<'static, ()>,
|
tail: *mut Handle<'static, ()>,
|
||||||
priv next_id: Cell<uint>,
|
next_id: Cell<uint>,
|
||||||
priv marker1: marker::NoSend,
|
marker1: marker::NoSend,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A handle to a receiver which is currently a member of a `Select` set of
|
/// A handle to a receiver which is currently a member of a `Select` set of
|
||||||
|
@ -74,16 +74,16 @@ pub struct Select {
|
||||||
pub struct Handle<'rx, T> {
|
pub struct Handle<'rx, T> {
|
||||||
/// The ID of this handle, used to compare against the return value of
|
/// The ID of this handle, used to compare against the return value of
|
||||||
/// `Select::wait()`
|
/// `Select::wait()`
|
||||||
priv id: uint,
|
id: uint,
|
||||||
priv selector: &'rx Select,
|
selector: &'rx Select,
|
||||||
priv next: *mut Handle<'static, ()>,
|
next: *mut Handle<'static, ()>,
|
||||||
priv prev: *mut Handle<'static, ()>,
|
prev: *mut Handle<'static, ()>,
|
||||||
priv added: bool,
|
added: bool,
|
||||||
priv packet: &'rx Packet,
|
packet: &'rx Packet,
|
||||||
|
|
||||||
// due to our fun transmutes, we be sure to place this at the end. (nothing
|
// due to our fun transmutes, we be sure to place this at the end. (nothing
|
||||||
// previous relies on T)
|
// previous relies on T)
|
||||||
priv rx: &'rx Receiver<T>,
|
rx: &'rx Receiver<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Packets { cur: *mut Handle<'static, ()> }
|
struct Packets { cur: *mut Handle<'static, ()> }
|
||||||
|
|
|
@ -508,20 +508,20 @@ pub type Result = io::IoResult<()>;
|
||||||
/// traits.
|
/// traits.
|
||||||
pub struct Formatter<'a> {
|
pub struct Formatter<'a> {
|
||||||
/// Flags for formatting (packed version of rt::Flag)
|
/// Flags for formatting (packed version of rt::Flag)
|
||||||
flags: uint,
|
pub flags: uint,
|
||||||
/// Character used as 'fill' whenever there is alignment
|
/// Character used as 'fill' whenever there is alignment
|
||||||
fill: char,
|
pub fill: char,
|
||||||
/// Boolean indication of whether the output should be left-aligned
|
/// Boolean indication of whether the output should be left-aligned
|
||||||
align: parse::Alignment,
|
pub align: parse::Alignment,
|
||||||
/// Optionally specified integer width that the output should be
|
/// Optionally specified integer width that the output should be
|
||||||
width: Option<uint>,
|
pub width: Option<uint>,
|
||||||
/// Optionally specified precision for numeric types
|
/// Optionally specified precision for numeric types
|
||||||
precision: Option<uint>,
|
pub precision: Option<uint>,
|
||||||
|
|
||||||
/// Output buffer.
|
/// Output buffer.
|
||||||
buf: &'a mut io::Writer,
|
pub buf: &'a mut io::Writer,
|
||||||
priv curarg: slice::Items<'a, Argument<'a>>,
|
curarg: slice::Items<'a, Argument<'a>>,
|
||||||
priv args: &'a [Argument<'a>],
|
args: &'a [Argument<'a>],
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This struct represents the generic "argument" which is taken by the Xprintf
|
/// This struct represents the generic "argument" which is taken by the Xprintf
|
||||||
|
@ -529,8 +529,8 @@ pub struct Formatter<'a> {
|
||||||
/// compile time it is ensured that the function and the value have the correct
|
/// compile time it is ensured that the function and the value have the correct
|
||||||
/// types, and then this struct is used to canonicalize arguments to one type.
|
/// types, and then this struct is used to canonicalize arguments to one type.
|
||||||
pub struct Argument<'a> {
|
pub struct Argument<'a> {
|
||||||
priv formatter: extern "Rust" fn(&any::Void, &mut Formatter) -> Result,
|
formatter: extern "Rust" fn(&any::Void, &mut Formatter) -> Result,
|
||||||
priv value: &'a any::Void,
|
value: &'a any::Void,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Arguments<'a> {
|
impl<'a> Arguments<'a> {
|
||||||
|
@ -555,8 +555,8 @@ impl<'a> Arguments<'a> {
|
||||||
/// string at compile-time so usage of the `write` and `format` functions can
|
/// string at compile-time so usage of the `write` and `format` functions can
|
||||||
/// be safely performed.
|
/// be safely performed.
|
||||||
pub struct Arguments<'a> {
|
pub struct Arguments<'a> {
|
||||||
priv fmt: &'a [rt::Piece<'a>],
|
fmt: &'a [rt::Piece<'a>],
|
||||||
priv args: &'a [Argument<'a>],
|
args: &'a [Argument<'a>],
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When a format is not otherwise specified, types are formatted by ascribing
|
/// When a format is not otherwise specified, types are formatted by ascribing
|
||||||
|
|
|
@ -108,7 +108,7 @@ radix!(UpperHex, 16, "0x", x @ 0 .. 9 => '0' as u8 + x,
|
||||||
/// A radix with in the range of `2..36`.
|
/// A radix with in the range of `2..36`.
|
||||||
#[deriving(Clone, Eq)]
|
#[deriving(Clone, Eq)]
|
||||||
pub struct Radix {
|
pub struct Radix {
|
||||||
priv base: u8,
|
base: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Radix {
|
impl Radix {
|
||||||
|
|
|
@ -37,30 +37,30 @@ pub enum Piece<'a> {
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub struct Argument<'a> {
|
pub struct Argument<'a> {
|
||||||
/// Where to find this argument
|
/// Where to find this argument
|
||||||
position: Position<'a>,
|
pub position: Position<'a>,
|
||||||
/// How to format the argument
|
/// How to format the argument
|
||||||
format: FormatSpec<'a>,
|
pub format: FormatSpec<'a>,
|
||||||
/// If not `None`, what method to invoke on the argument
|
/// 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.
|
/// Specification for the formatting of an argument in the format string.
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub struct FormatSpec<'a> {
|
pub struct FormatSpec<'a> {
|
||||||
/// Optionally specified character to fill alignment with
|
/// Optionally specified character to fill alignment with
|
||||||
fill: Option<char>,
|
pub fill: Option<char>,
|
||||||
/// Optionally specified alignment
|
/// Optionally specified alignment
|
||||||
align: Alignment,
|
pub align: Alignment,
|
||||||
/// Packed version of various flags provided
|
/// Packed version of various flags provided
|
||||||
flags: uint,
|
pub flags: uint,
|
||||||
/// The integer precision to use
|
/// The integer precision to use
|
||||||
precision: Count<'a>,
|
pub precision: Count<'a>,
|
||||||
/// The string width requested for the resulting format
|
/// 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
|
/// The descriptor string representing the name of the format desired for
|
||||||
/// this argument, this can be empty or any number of characters, although
|
/// this argument, this can be empty or any number of characters, although
|
||||||
/// it is required to be one word.
|
/// 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.
|
/// Enum describing where an argument for a format can be located.
|
||||||
|
@ -154,9 +154,9 @@ pub enum PluralSelector {
|
||||||
pub struct PluralArm<'a> {
|
pub struct PluralArm<'a> {
|
||||||
/// A selector can either be specified by a keyword or with an integer
|
/// A selector can either be specified by a keyword or with an integer
|
||||||
/// literal.
|
/// literal.
|
||||||
selector: PluralSelector,
|
pub selector: PluralSelector,
|
||||||
/// Array of pieces which are the format of this arm
|
/// 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
|
/// Enum of the 5 CLDR plural keywords. There is one more, "other", but that
|
||||||
|
@ -182,9 +182,9 @@ pub enum PluralKeyword {
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub struct SelectArm<'a> {
|
pub struct SelectArm<'a> {
|
||||||
/// String selector which guards this arm
|
/// String selector which guards this arm
|
||||||
selector: &'a str,
|
pub selector: &'a str,
|
||||||
/// Array of pieces which are the format of this arm
|
/// 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
|
/// 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
|
/// This is a recursive-descent parser for the sake of simplicity, and if
|
||||||
/// necessary there's probably lots of room for improvement performance-wise.
|
/// necessary there's probably lots of room for improvement performance-wise.
|
||||||
pub struct Parser<'a> {
|
pub struct Parser<'a> {
|
||||||
priv input: &'a str,
|
input: &'a str,
|
||||||
priv cur: str::CharOffsets<'a>,
|
cur: str::CharOffsets<'a>,
|
||||||
priv depth: uint,
|
depth: uint,
|
||||||
/// Error messages accumulated during parsing
|
/// Error messages accumulated during parsing
|
||||||
errors: ~[~str],
|
pub errors: ~[~str],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator<Piece<'a>> for Parser<'a> {
|
impl<'a> Iterator<Piece<'a>> for Parser<'a> {
|
||||||
|
|
|
@ -28,17 +28,17 @@ pub enum Piece<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Argument<'a> {
|
pub struct Argument<'a> {
|
||||||
position: Position,
|
pub position: Position,
|
||||||
format: FormatSpec,
|
pub format: FormatSpec,
|
||||||
method: Option<&'a Method<'a>>
|
pub method: Option<&'a Method<'a>>
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct FormatSpec {
|
pub struct FormatSpec {
|
||||||
fill: char,
|
pub fill: char,
|
||||||
align: parse::Alignment,
|
pub align: parse::Alignment,
|
||||||
flags: uint,
|
pub flags: uint,
|
||||||
precision: Count,
|
pub precision: Count,
|
||||||
width: Count,
|
pub width: Count,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Count {
|
pub enum Count {
|
||||||
|
@ -60,11 +60,11 @@ pub enum PluralSelector {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PluralArm<'a> {
|
pub struct PluralArm<'a> {
|
||||||
selector: PluralSelector,
|
pub selector: PluralSelector,
|
||||||
result: &'a [Piece<'a>],
|
pub result: &'a [Piece<'a>],
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SelectArm<'a> {
|
pub struct SelectArm<'a> {
|
||||||
selector: &'a str,
|
pub selector: &'a str,
|
||||||
result: &'a [Piece<'a>],
|
pub result: &'a [Piece<'a>],
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,14 @@ use managed;
|
||||||
task annihilation. For now, cycles need to be broken manually by using `Rc<T>` \
|
task annihilation. For now, cycles need to be broken manually by using `Rc<T>` \
|
||||||
with a non-owning `Weak<T>` pointer. A tracing garbage collector is planned."]
|
with a non-owning `Weak<T>` pointer. A tracing garbage collector is planned."]
|
||||||
pub struct Gc<T> {
|
pub struct Gc<T> {
|
||||||
priv ptr: @T,
|
ptr: @T,
|
||||||
priv marker: marker::NoSend,
|
marker: marker::NoSend,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub struct Gc<T> {
|
pub struct Gc<T> {
|
||||||
priv ptr: @T,
|
ptr: @T,
|
||||||
priv marker: marker::NoSend,
|
marker: marker::NoSend,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: 'static> Gc<T> {
|
impl<T: 'static> Gc<T> {
|
||||||
|
|
|
@ -36,15 +36,15 @@ use super::{Hash, Hasher};
|
||||||
|
|
||||||
/// `SipState` computes a SipHash 2-4 hash over a stream of bytes.
|
/// `SipState` computes a SipHash 2-4 hash over a stream of bytes.
|
||||||
pub struct SipState {
|
pub struct SipState {
|
||||||
priv k0: u64,
|
k0: u64,
|
||||||
priv k1: u64,
|
k1: u64,
|
||||||
priv length: uint, // how many bytes we've processed
|
length: uint, // how many bytes we've processed
|
||||||
priv v0: u64, // hash state
|
v0: u64, // hash state
|
||||||
priv v1: u64,
|
v1: u64,
|
||||||
priv v2: u64,
|
v2: u64,
|
||||||
priv v3: u64,
|
v3: u64,
|
||||||
priv tail: [u8, ..8], // unprocessed bytes
|
tail: [u8, ..8], // unprocessed bytes
|
||||||
priv ntail: uint, // how many bytes in tail are valid
|
ntail: uint, // how many bytes in tail are valid
|
||||||
}
|
}
|
||||||
|
|
||||||
// sadly, these macro definitions can't appear later,
|
// sadly, these macro definitions can't appear later,
|
||||||
|
@ -231,8 +231,8 @@ impl Default for SipState {
|
||||||
/// `SipHasher` computes the SipHash algorithm from a stream of bytes.
|
/// `SipHasher` computes the SipHash algorithm from a stream of bytes.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct SipHasher {
|
pub struct SipHasher {
|
||||||
priv k0: u64,
|
k0: u64,
|
||||||
priv k1: u64,
|
k1: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SipHasher {
|
impl SipHasher {
|
||||||
|
|
|
@ -53,19 +53,19 @@ pub type GlueFn = extern "Rust" fn(*i8);
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
pub struct TyDesc {
|
pub struct TyDesc {
|
||||||
// sizeof(T)
|
// sizeof(T)
|
||||||
size: uint,
|
pub size: uint,
|
||||||
|
|
||||||
// alignof(T)
|
// alignof(T)
|
||||||
align: uint,
|
pub align: uint,
|
||||||
|
|
||||||
// Called when a value of type `T` is no longer needed
|
// Called when a value of type `T` is no longer needed
|
||||||
drop_glue: GlueFn,
|
pub drop_glue: GlueFn,
|
||||||
|
|
||||||
// Called by reflection visitor to visit a value of type `T`
|
// Called by reflection visitor to visit a value of type `T`
|
||||||
visit_glue: GlueFn,
|
pub visit_glue: GlueFn,
|
||||||
|
|
||||||
// Name corresponding to the type
|
// Name corresponding to the type
|
||||||
name: &'static str
|
pub name: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[lang="opaque"]
|
#[lang="opaque"]
|
||||||
|
@ -454,7 +454,7 @@ extern "rust-intrinsic" {
|
||||||
#[deriving(Eq, Hash, Show, TotalEq)]
|
#[deriving(Eq, Hash, Show, TotalEq)]
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
pub struct TypeId {
|
pub struct TypeId {
|
||||||
priv t: u64,
|
t: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
|
|
|
@ -43,10 +43,10 @@ use vec::Vec;
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub struct BufferedReader<R> {
|
pub struct BufferedReader<R> {
|
||||||
priv inner: R,
|
inner: R,
|
||||||
priv buf: Vec<u8>,
|
buf: Vec<u8>,
|
||||||
priv pos: uint,
|
pos: uint,
|
||||||
priv cap: uint,
|
cap: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Reader> BufferedReader<R> {
|
impl<R: Reader> BufferedReader<R> {
|
||||||
|
@ -135,9 +135,9 @@ impl<R: Reader> Reader for BufferedReader<R> {
|
||||||
/// writer.flush();
|
/// writer.flush();
|
||||||
/// ```
|
/// ```
|
||||||
pub struct BufferedWriter<W> {
|
pub struct BufferedWriter<W> {
|
||||||
priv inner: Option<W>,
|
inner: Option<W>,
|
||||||
priv buf: Vec<u8>,
|
buf: Vec<u8>,
|
||||||
priv pos: uint
|
pos: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: Writer> BufferedWriter<W> {
|
impl<W: Writer> BufferedWriter<W> {
|
||||||
|
@ -220,7 +220,7 @@ impl<W: Writer> Drop for BufferedWriter<W> {
|
||||||
///
|
///
|
||||||
/// This writer will be flushed when it is dropped.
|
/// This writer will be flushed when it is dropped.
|
||||||
pub struct LineBufferedWriter<W> {
|
pub struct LineBufferedWriter<W> {
|
||||||
priv inner: BufferedWriter<W>,
|
inner: BufferedWriter<W>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<W: Writer> LineBufferedWriter<W> {
|
impl<W: Writer> LineBufferedWriter<W> {
|
||||||
|
@ -303,7 +303,7 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> {
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub struct BufferedStream<S> {
|
pub struct BufferedStream<S> {
|
||||||
priv inner: BufferedReader<InternalBufferedWriter<S>>
|
inner: BufferedReader<InternalBufferedWriter<S>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Stream> BufferedStream<S> {
|
impl<S: Stream> BufferedStream<S> {
|
||||||
|
@ -391,7 +391,7 @@ mod test {
|
||||||
|
|
||||||
/// A dummy reader intended at testing short-reads propagation.
|
/// A dummy reader intended at testing short-reads propagation.
|
||||||
pub struct ShortReader {
|
pub struct ShortReader {
|
||||||
priv lengths: ~[uint],
|
lengths: ~[uint],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reader for ShortReader {
|
impl Reader for ShortReader {
|
||||||
|
|
|
@ -36,10 +36,10 @@ use slice::{bytes, CloneableVector, MutableVector, ImmutableVector};
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub struct ChanReader {
|
pub struct ChanReader {
|
||||||
priv buf: Option<~[u8]>, // A buffer of bytes received but not consumed.
|
buf: Option<~[u8]>, // A buffer of bytes received but not consumed.
|
||||||
priv pos: uint, // How many of the buffered bytes have already be consumed.
|
pos: uint, // How many of the buffered bytes have already be consumed.
|
||||||
priv rx: Receiver<~[u8]>, // The rx to pull data from.
|
rx: Receiver<~[u8]>, // The rx to pull data from.
|
||||||
priv closed: bool, // Whether the pipe this rx connects to has been closed.
|
closed: bool, // Whether the pipe this rx connects to has been closed.
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChanReader {
|
impl ChanReader {
|
||||||
|
@ -98,7 +98,7 @@ impl Reader for ChanReader {
|
||||||
/// writer.write("hello, world".as_bytes());
|
/// writer.write("hello, world".as_bytes());
|
||||||
/// ```
|
/// ```
|
||||||
pub struct ChanWriter {
|
pub struct ChanWriter {
|
||||||
priv tx: Sender<~[u8]>,
|
tx: Sender<~[u8]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChanWriter {
|
impl ChanWriter {
|
||||||
|
|
|
@ -38,7 +38,7 @@ use ptr::RawPtr;
|
||||||
/// Any error other than `EndOfFile` that is produced by the underlying Reader
|
/// Any error other than `EndOfFile` that is produced by the underlying Reader
|
||||||
/// is returned by the iterator and should be handled by the caller.
|
/// is returned by the iterator and should be handled by the caller.
|
||||||
pub struct Bytes<'r, T> {
|
pub struct Bytes<'r, T> {
|
||||||
priv reader: &'r mut T,
|
reader: &'r mut T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r, R: Reader> Bytes<'r, R> {
|
impl<'r, R: Reader> Bytes<'r, R> {
|
||||||
|
|
|
@ -78,9 +78,9 @@ use vec::Vec;
|
||||||
/// configured at creation time, via the `FileAccess` parameter to
|
/// configured at creation time, via the `FileAccess` parameter to
|
||||||
/// `File::open_mode()`.
|
/// `File::open_mode()`.
|
||||||
pub struct File {
|
pub struct File {
|
||||||
priv fd: ~RtioFileStream:Send,
|
fd: ~RtioFileStream:Send,
|
||||||
priv path: Path,
|
path: Path,
|
||||||
priv last_nread: int,
|
last_nread: int,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl File {
|
impl File {
|
||||||
|
@ -498,7 +498,7 @@ pub fn walk_dir(path: &Path) -> IoResult<Directories> {
|
||||||
|
|
||||||
/// An iterator which walks over a directory
|
/// An iterator which walks over a directory
|
||||||
pub struct Directories {
|
pub struct Directories {
|
||||||
priv stack: ~[Path],
|
stack: ~[Path],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator<Path> for Directories {
|
impl Iterator<Path> for Directories {
|
||||||
|
|
|
@ -52,8 +52,8 @@ fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult<u64>
|
||||||
/// assert_eq!(w.unwrap(), ~[0, 1, 2]);
|
/// assert_eq!(w.unwrap(), ~[0, 1, 2]);
|
||||||
/// ```
|
/// ```
|
||||||
pub struct MemWriter {
|
pub struct MemWriter {
|
||||||
priv buf: ~[u8],
|
buf: ~[u8],
|
||||||
priv pos: uint,
|
pos: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MemWriter {
|
impl MemWriter {
|
||||||
|
@ -132,8 +132,8 @@ impl Seek for MemWriter {
|
||||||
/// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2]);
|
/// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2]);
|
||||||
/// ```
|
/// ```
|
||||||
pub struct MemReader {
|
pub struct MemReader {
|
||||||
priv buf: ~[u8],
|
buf: ~[u8],
|
||||||
priv pos: uint
|
pos: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MemReader {
|
impl MemReader {
|
||||||
|
@ -219,8 +219,8 @@ impl Buffer for MemReader {
|
||||||
/// assert!(buf == [0, 1, 2, 0]);
|
/// assert!(buf == [0, 1, 2, 0]);
|
||||||
/// ```
|
/// ```
|
||||||
pub struct BufWriter<'a> {
|
pub struct BufWriter<'a> {
|
||||||
priv buf: &'a mut [u8],
|
buf: &'a mut [u8],
|
||||||
priv pos: uint
|
pos: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BufWriter<'a> {
|
impl<'a> BufWriter<'a> {
|
||||||
|
@ -275,8 +275,8 @@ impl<'a> Seek for BufWriter<'a> {
|
||||||
/// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2, 3]);
|
/// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2, 3]);
|
||||||
/// ```
|
/// ```
|
||||||
pub struct BufReader<'a> {
|
pub struct BufReader<'a> {
|
||||||
priv buf: &'a [u8],
|
buf: &'a [u8],
|
||||||
priv pos: uint
|
pos: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BufReader<'a> {
|
impl<'a> BufReader<'a> {
|
||||||
|
|
|
@ -283,11 +283,11 @@ pub type IoResult<T> = Result<T, IoError>;
|
||||||
pub struct IoError {
|
pub struct IoError {
|
||||||
/// An enumeration which can be matched against for determining the flavor
|
/// An enumeration which can be matched against for determining the flavor
|
||||||
/// of error.
|
/// of error.
|
||||||
kind: IoErrorKind,
|
pub kind: IoErrorKind,
|
||||||
/// A human-readable description about the error
|
/// A human-readable description about the error
|
||||||
desc: &'static str,
|
pub desc: &'static str,
|
||||||
/// Detailed information about this error, not always available
|
/// Detailed information about this error, not always available
|
||||||
detail: Option<~str>
|
pub detail: Option<~str>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for IoError {
|
impl fmt::Show for IoError {
|
||||||
|
@ -1023,7 +1023,7 @@ impl<T: Reader + Writer> Stream for T {}
|
||||||
/// Any error other than `EndOfFile` that is produced by the underlying Reader
|
/// Any error other than `EndOfFile` that is produced by the underlying Reader
|
||||||
/// is returned by the iterator and should be handled by the caller.
|
/// is returned by the iterator and should be handled by the caller.
|
||||||
pub struct Lines<'r, T> {
|
pub struct Lines<'r, T> {
|
||||||
priv buffer: &'r mut T,
|
buffer: &'r mut T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r, T: Buffer> Iterator<IoResult<~str>> for Lines<'r, T> {
|
impl<'r, T: Buffer> Iterator<IoResult<~str>> for Lines<'r, T> {
|
||||||
|
@ -1050,7 +1050,7 @@ impl<'r, T: Buffer> Iterator<IoResult<~str>> for Lines<'r, T> {
|
||||||
/// Any error other than `EndOfFile` that is produced by the underlying Reader
|
/// Any error other than `EndOfFile` that is produced by the underlying Reader
|
||||||
/// is returned by the iterator and should be handled by the caller.
|
/// is returned by the iterator and should be handled by the caller.
|
||||||
pub struct Chars<'r, T> {
|
pub struct Chars<'r, T> {
|
||||||
priv buffer: &'r mut T
|
buffer: &'r mut T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'r, T: Buffer> Iterator<IoResult<char>> for Chars<'r, T> {
|
impl<'r, T: Buffer> Iterator<IoResult<char>> for Chars<'r, T> {
|
||||||
|
@ -1290,7 +1290,7 @@ pub trait Acceptor<T> {
|
||||||
/// connection attempt was successful. A successful connection will be wrapped
|
/// connection attempt was successful. A successful connection will be wrapped
|
||||||
/// in `Ok`. A failed connection is represented as an `Err`.
|
/// in `Ok`. A failed connection is represented as an `Err`.
|
||||||
pub struct IncomingConnections<'a, A> {
|
pub struct IncomingConnections<'a, A> {
|
||||||
priv inc: &'a mut A,
|
inc: &'a mut A,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T, A: Acceptor<T>> Iterator<IoResult<T>> for IncomingConnections<'a, A> {
|
impl<'a, T, A: Acceptor<T>> Iterator<IoResult<T>> for IncomingConnections<'a, A> {
|
||||||
|
@ -1389,13 +1389,13 @@ pub enum FileType {
|
||||||
#[deriving(Hash)]
|
#[deriving(Hash)]
|
||||||
pub struct FileStat {
|
pub struct FileStat {
|
||||||
/// The path that this stat structure is describing
|
/// The path that this stat structure is describing
|
||||||
path: Path,
|
pub path: Path,
|
||||||
/// The size of the file, in bytes
|
/// The size of the file, in bytes
|
||||||
size: u64,
|
pub size: u64,
|
||||||
/// The kind of file this path points to (directory, file, pipe, etc.)
|
/// The kind of file this path points to (directory, file, pipe, etc.)
|
||||||
kind: FileType,
|
pub kind: FileType,
|
||||||
/// The file permissions currently on the file
|
/// The file permissions currently on the file
|
||||||
perm: FilePermission,
|
pub perm: FilePermission,
|
||||||
|
|
||||||
// FIXME(#10301): These time fields are pretty useless without an actual
|
// FIXME(#10301): These time fields are pretty useless without an actual
|
||||||
// time representation, what are the milliseconds relative
|
// time representation, what are the milliseconds relative
|
||||||
|
@ -1403,13 +1403,13 @@ pub struct FileStat {
|
||||||
|
|
||||||
/// The time that the file was created at, in platform-dependent
|
/// The time that the file was created at, in platform-dependent
|
||||||
/// milliseconds
|
/// milliseconds
|
||||||
created: u64,
|
pub created: u64,
|
||||||
/// The time that this file was last modified, in platform-dependent
|
/// The time that this file was last modified, in platform-dependent
|
||||||
/// milliseconds
|
/// milliseconds
|
||||||
modified: u64,
|
pub modified: u64,
|
||||||
/// The time that this file was last accessed, in platform-dependent
|
/// The time that this file was last accessed, in platform-dependent
|
||||||
/// milliseconds
|
/// milliseconds
|
||||||
accessed: u64,
|
pub accessed: u64,
|
||||||
|
|
||||||
/// Information returned by stat() which is not guaranteed to be
|
/// Information returned by stat() which is not guaranteed to be
|
||||||
/// platform-independent. This information may be useful on some platforms,
|
/// platform-independent. This information may be useful on some platforms,
|
||||||
|
@ -1419,7 +1419,7 @@ pub struct FileStat {
|
||||||
/// Usage of this field is discouraged, but if access is desired then the
|
/// Usage of this field is discouraged, but if access is desired then the
|
||||||
/// fields are located here.
|
/// fields are located here.
|
||||||
#[unstable]
|
#[unstable]
|
||||||
unstable: UnstableFileStat,
|
pub unstable: UnstableFileStat,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This structure represents all of the possible information which can be
|
/// This structure represents all of the possible information which can be
|
||||||
|
@ -1430,25 +1430,25 @@ pub struct FileStat {
|
||||||
#[deriving(Hash)]
|
#[deriving(Hash)]
|
||||||
pub struct UnstableFileStat {
|
pub struct UnstableFileStat {
|
||||||
/// The ID of the device containing the file.
|
/// The ID of the device containing the file.
|
||||||
device: u64,
|
pub device: u64,
|
||||||
/// The file serial number.
|
/// The file serial number.
|
||||||
inode: u64,
|
pub inode: u64,
|
||||||
/// The device ID.
|
/// The device ID.
|
||||||
rdev: u64,
|
pub rdev: u64,
|
||||||
/// The number of hard links to this file.
|
/// The number of hard links to this file.
|
||||||
nlink: u64,
|
pub nlink: u64,
|
||||||
/// The user ID of the file.
|
/// The user ID of the file.
|
||||||
uid: u64,
|
pub uid: u64,
|
||||||
/// The group ID of the file.
|
/// The group ID of the file.
|
||||||
gid: u64,
|
pub gid: u64,
|
||||||
/// The optimal block size for I/O.
|
/// The optimal block size for I/O.
|
||||||
blksize: u64,
|
pub blksize: u64,
|
||||||
/// The blocks allocated for this file.
|
/// The blocks allocated for this file.
|
||||||
blocks: u64,
|
pub blocks: u64,
|
||||||
/// User-defined flags for the file.
|
/// User-defined flags for the file.
|
||||||
flags: u64,
|
pub flags: u64,
|
||||||
/// The file generation number.
|
/// The file generation number.
|
||||||
gen: u64,
|
pub gen: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A set of permissions for a file or directory is represented by a set of
|
/// A set of permissions for a file or directory is represented by a set of
|
||||||
|
|
|
@ -57,18 +57,18 @@ pub enum Protocol {
|
||||||
/// For details on these fields, see their corresponding definitions via
|
/// For details on these fields, see their corresponding definitions via
|
||||||
/// `man -s 3 getaddrinfo`
|
/// `man -s 3 getaddrinfo`
|
||||||
pub struct Hint {
|
pub struct Hint {
|
||||||
family: uint,
|
pub family: uint,
|
||||||
socktype: Option<SocketType>,
|
pub socktype: Option<SocketType>,
|
||||||
protocol: Option<Protocol>,
|
pub protocol: Option<Protocol>,
|
||||||
flags: uint,
|
pub flags: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Info {
|
pub struct Info {
|
||||||
address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
family: uint,
|
pub family: uint,
|
||||||
socktype: Option<SocketType>,
|
pub socktype: Option<SocketType>,
|
||||||
protocol: Option<Protocol>,
|
pub protocol: Option<Protocol>,
|
||||||
flags: uint,
|
pub flags: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Easy name resolution. Given a hostname, returns the list of IP addresses for
|
/// Easy name resolution. Given a hostname, returns the list of IP addresses for
|
||||||
|
|
|
@ -58,8 +58,8 @@ impl fmt::Show for IpAddr {
|
||||||
|
|
||||||
#[deriving(Eq, TotalEq, Clone, Hash)]
|
#[deriving(Eq, TotalEq, Clone, Hash)]
|
||||||
pub struct SocketAddr {
|
pub struct SocketAddr {
|
||||||
ip: IpAddr,
|
pub ip: IpAddr,
|
||||||
port: Port,
|
pub port: Port,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for SocketAddr {
|
impl fmt::Show for SocketAddr {
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
//! A TCP connection implements the `Reader` and `Writer` traits, while the TCP
|
//! A TCP connection implements the `Reader` and `Writer` traits, while the TCP
|
||||||
//! listener (socket server) implements the `Listener` and `Acceptor` traits.
|
//! listener (socket server) implements the `Listener` and `Acceptor` traits.
|
||||||
|
|
||||||
#![deny(missing_doc)]
|
|
||||||
|
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use io::IoResult;
|
use io::IoResult;
|
||||||
use io::net::ip::SocketAddr;
|
use io::net::ip::SocketAddr;
|
||||||
|
@ -46,7 +44,7 @@ use rt::rtio::{RtioTcpAcceptor, RtioTcpStream};
|
||||||
/// drop(stream); // close the connection
|
/// drop(stream); // close the connection
|
||||||
/// ```
|
/// ```
|
||||||
pub struct TcpStream {
|
pub struct TcpStream {
|
||||||
priv obj: ~RtioTcpStream:Send
|
obj: ~RtioTcpStream:Send
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TcpStream {
|
impl TcpStream {
|
||||||
|
@ -128,7 +126,7 @@ impl Writer for TcpStream {
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub struct TcpListener {
|
pub struct TcpListener {
|
||||||
priv obj: ~RtioTcpListener:Send
|
obj: ~RtioTcpListener:Send
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TcpListener {
|
impl TcpListener {
|
||||||
|
@ -161,7 +159,7 @@ impl Listener<TcpStream, TcpAcceptor> for TcpListener {
|
||||||
/// a `TcpListener`'s `listen` method, and this object can be used to accept new
|
/// a `TcpListener`'s `listen` method, and this object can be used to accept new
|
||||||
/// `TcpStream` instances.
|
/// `TcpStream` instances.
|
||||||
pub struct TcpAcceptor {
|
pub struct TcpAcceptor {
|
||||||
priv obj: ~RtioTcpAcceptor:Send
|
obj: ~RtioTcpAcceptor:Send
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Acceptor<TcpStream> for TcpAcceptor {
|
impl Acceptor<TcpStream> for TcpAcceptor {
|
||||||
|
|
|
@ -54,7 +54,7 @@ use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, LocalIo};
|
||||||
/// drop(socket); // close the socket
|
/// drop(socket); // close the socket
|
||||||
/// ```
|
/// ```
|
||||||
pub struct UdpSocket {
|
pub struct UdpSocket {
|
||||||
priv obj: ~RtioUdpSocket:Send
|
obj: ~RtioUdpSocket:Send
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UdpSocket {
|
impl UdpSocket {
|
||||||
|
@ -115,8 +115,8 @@ impl Clone for UdpSocket {
|
||||||
/// A type that allows convenient usage of a UDP stream connected to one
|
/// A type that allows convenient usage of a UDP stream connected to one
|
||||||
/// address via the `Reader` and `Writer` traits.
|
/// address via the `Reader` and `Writer` traits.
|
||||||
pub struct UdpStream {
|
pub struct UdpStream {
|
||||||
priv socket: UdpSocket,
|
socket: UdpSocket,
|
||||||
priv connected_to: SocketAddr
|
connected_to: SocketAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UdpStream {
|
impl UdpStream {
|
||||||
|
|
|
@ -36,7 +36,7 @@ use rt::rtio::{RtioUnixAcceptor, RtioPipe};
|
||||||
|
|
||||||
/// A stream which communicates over a named pipe.
|
/// A stream which communicates over a named pipe.
|
||||||
pub struct UnixStream {
|
pub struct UnixStream {
|
||||||
priv obj: PipeStream,
|
obj: PipeStream,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnixStream {
|
impl UnixStream {
|
||||||
|
@ -83,7 +83,7 @@ impl Writer for UnixStream {
|
||||||
/// A value that can listen for incoming named pipe connection requests.
|
/// A value that can listen for incoming named pipe connection requests.
|
||||||
pub struct UnixListener {
|
pub struct UnixListener {
|
||||||
/// The internal, opaque runtime Unix listener.
|
/// The internal, opaque runtime Unix listener.
|
||||||
priv obj: ~RtioUnixListener:Send,
|
obj: ~RtioUnixListener:Send,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UnixListener {
|
impl UnixListener {
|
||||||
|
@ -125,7 +125,7 @@ impl Listener<UnixStream, UnixAcceptor> for UnixListener {
|
||||||
/// A value that can accept named pipe connections, returned from `listen()`.
|
/// A value that can accept named pipe connections, returned from `listen()`.
|
||||||
pub struct UnixAcceptor {
|
pub struct UnixAcceptor {
|
||||||
/// The internal, opaque runtime Unix acceptor.
|
/// The internal, opaque runtime Unix acceptor.
|
||||||
priv obj: ~RtioUnixAcceptor:Send,
|
obj: ~RtioUnixAcceptor:Send,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Acceptor<UnixStream> for UnixAcceptor {
|
impl Acceptor<UnixStream> for UnixAcceptor {
|
||||||
|
|
|
@ -23,7 +23,7 @@ use rt::rtio::{RtioPipe, LocalIo};
|
||||||
/// A synchronous, in-memory pipe.
|
/// A synchronous, in-memory pipe.
|
||||||
pub struct PipeStream {
|
pub struct PipeStream {
|
||||||
/// The internal, opaque runtime pipe object.
|
/// The internal, opaque runtime pipe object.
|
||||||
priv obj: ~RtioPipe:Send,
|
obj: ~RtioPipe:Send,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PipeStream {
|
impl PipeStream {
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
//! Bindings for executing child processes
|
//! Bindings for executing child processes
|
||||||
|
|
||||||
#![deny(missing_doc)]
|
|
||||||
|
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
|
||||||
use fmt;
|
use fmt;
|
||||||
|
@ -53,23 +51,23 @@ use rt::rtio::{RtioProcess, IoFactory, LocalIo};
|
||||||
/// assert!(child.wait().success());
|
/// assert!(child.wait().success());
|
||||||
/// ```
|
/// ```
|
||||||
pub struct Process {
|
pub struct Process {
|
||||||
priv handle: ~RtioProcess:Send,
|
handle: ~RtioProcess:Send,
|
||||||
|
|
||||||
/// Handle to the child's stdin, if the `stdin` field of this process's
|
/// Handle to the child's stdin, if the `stdin` field of this process's
|
||||||
/// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
|
/// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
|
||||||
stdin: Option<io::PipeStream>,
|
pub stdin: Option<io::PipeStream>,
|
||||||
|
|
||||||
/// Handle to the child's stdout, if the `stdout` field of this process's
|
/// Handle to the child's stdout, if the `stdout` field of this process's
|
||||||
/// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
|
/// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
|
||||||
stdout: Option<io::PipeStream>,
|
pub stdout: Option<io::PipeStream>,
|
||||||
|
|
||||||
/// Handle to the child's stderr, if the `stderr` field of this process's
|
/// Handle to the child's stderr, if the `stderr` field of this process's
|
||||||
/// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
|
/// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`.
|
||||||
stderr: Option<io::PipeStream>,
|
pub stderr: Option<io::PipeStream>,
|
||||||
|
|
||||||
/// Extra I/O handles as configured by the original `ProcessConfig` when
|
/// Extra I/O handles as configured by the original `ProcessConfig` when
|
||||||
/// this process was created. This is by default empty.
|
/// this process was created. This is by default empty.
|
||||||
extra_io: ~[Option<io::PipeStream>],
|
pub extra_io: ~[Option<io::PipeStream>],
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This configuration describes how a new process should be spawned. A blank
|
/// This configuration describes how a new process should be spawned. A blank
|
||||||
|
@ -88,33 +86,33 @@ pub struct Process {
|
||||||
/// ```
|
/// ```
|
||||||
pub struct ProcessConfig<'a> {
|
pub struct ProcessConfig<'a> {
|
||||||
/// Path to the program to run
|
/// Path to the program to run
|
||||||
program: &'a str,
|
pub program: &'a str,
|
||||||
|
|
||||||
/// Arguments to pass to the program (doesn't include the program itself)
|
/// Arguments to pass to the program (doesn't include the program itself)
|
||||||
args: &'a [~str],
|
pub args: &'a [~str],
|
||||||
|
|
||||||
/// Optional environment to specify for the program. If this is None, then
|
/// Optional environment to specify for the program. If this is None, then
|
||||||
/// it will inherit the current process's environment.
|
/// it will inherit the current process's environment.
|
||||||
env: Option<&'a [(~str, ~str)]>,
|
pub env: Option<&'a [(~str, ~str)]>,
|
||||||
|
|
||||||
/// Optional working directory for the new process. If this is None, then
|
/// Optional working directory for the new process. If this is None, then
|
||||||
/// the current directory of the running process is inherited.
|
/// the current directory of the running process is inherited.
|
||||||
cwd: Option<&'a Path>,
|
pub cwd: Option<&'a Path>,
|
||||||
|
|
||||||
/// Configuration for the child process's stdin handle (file descriptor 0).
|
/// Configuration for the child process's stdin handle (file descriptor 0).
|
||||||
/// This field defaults to `CreatePipe(true, false)` so the input can be
|
/// This field defaults to `CreatePipe(true, false)` so the input can be
|
||||||
/// written to.
|
/// written to.
|
||||||
stdin: StdioContainer,
|
pub stdin: StdioContainer,
|
||||||
|
|
||||||
/// Configuration for the child process's stdout handle (file descriptor 1).
|
/// Configuration for the child process's stdout handle (file descriptor 1).
|
||||||
/// This field defaults to `CreatePipe(false, true)` so the output can be
|
/// This field defaults to `CreatePipe(false, true)` so the output can be
|
||||||
/// collected.
|
/// collected.
|
||||||
stdout: StdioContainer,
|
pub stdout: StdioContainer,
|
||||||
|
|
||||||
/// Configuration for the child process's stdout handle (file descriptor 2).
|
/// Configuration for the child process's stdout handle (file descriptor 2).
|
||||||
/// This field defaults to `CreatePipe(false, true)` so the output can be
|
/// This field defaults to `CreatePipe(false, true)` so the output can be
|
||||||
/// collected.
|
/// collected.
|
||||||
stderr: StdioContainer,
|
pub stderr: StdioContainer,
|
||||||
|
|
||||||
/// Any number of streams/file descriptors/pipes may be attached to this
|
/// Any number of streams/file descriptors/pipes may be attached to this
|
||||||
/// process. This list enumerates the file descriptors and such for the
|
/// process. This list enumerates the file descriptors and such for the
|
||||||
|
@ -122,31 +120,31 @@ pub struct ProcessConfig<'a> {
|
||||||
/// 3 and go to the length of this array. The first three file descriptors
|
/// 3 and go to the length of this array. The first three file descriptors
|
||||||
/// (stdin/stdout/stderr) are configured with the `stdin`, `stdout`, and
|
/// (stdin/stdout/stderr) are configured with the `stdin`, `stdout`, and
|
||||||
/// `stderr` fields.
|
/// `stderr` fields.
|
||||||
extra_io: &'a [StdioContainer],
|
pub extra_io: &'a [StdioContainer],
|
||||||
|
|
||||||
/// Sets the child process's user id. This translates to a `setuid` call in
|
/// Sets the child process's user id. This translates to a `setuid` call in
|
||||||
/// the child process. Setting this value on windows will cause the spawn to
|
/// the child process. Setting this value on windows will cause the spawn to
|
||||||
/// fail. Failure in the `setuid` call on unix will also cause the spawn to
|
/// fail. Failure in the `setuid` call on unix will also cause the spawn to
|
||||||
/// fail.
|
/// fail.
|
||||||
uid: Option<uint>,
|
pub uid: Option<uint>,
|
||||||
|
|
||||||
/// Similar to `uid`, but sets the group id of the child process. This has
|
/// Similar to `uid`, but sets the group id of the child process. This has
|
||||||
/// the same semantics as the `uid` field.
|
/// the same semantics as the `uid` field.
|
||||||
gid: Option<uint>,
|
pub gid: Option<uint>,
|
||||||
|
|
||||||
/// If true, the child process is spawned in a detached state. On unix, this
|
/// If true, the child process is spawned in a detached state. On unix, this
|
||||||
/// means that the child is the leader of a new process group.
|
/// means that the child is the leader of a new process group.
|
||||||
detach: bool,
|
pub detach: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The output of a finished process.
|
/// The output of a finished process.
|
||||||
pub struct ProcessOutput {
|
pub struct ProcessOutput {
|
||||||
/// The status (exit code) of the process.
|
/// The status (exit code) of the process.
|
||||||
status: ProcessExit,
|
pub status: ProcessExit,
|
||||||
/// The data that the process wrote to stdout.
|
/// The data that the process wrote to stdout.
|
||||||
output: ~[u8],
|
pub output: ~[u8],
|
||||||
/// The data that the process wrote to stderr.
|
/// The data that the process wrote to stderr.
|
||||||
error: ~[u8],
|
pub error: ~[u8],
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describes what to do with a standard io stream for a child process.
|
/// Describes what to do with a standard io stream for a child process.
|
||||||
|
|
|
@ -81,15 +81,15 @@ pub enum Signum {
|
||||||
/// ```
|
/// ```
|
||||||
pub struct Listener {
|
pub struct Listener {
|
||||||
/// A map from signums to handles to keep the handles in memory
|
/// A map from signums to handles to keep the handles in memory
|
||||||
priv handles: ~[(Signum, ~RtioSignal)],
|
handles: ~[(Signum, ~RtioSignal)],
|
||||||
/// This is where all the handles send signums, which are received by
|
/// This is where all the handles send signums, which are received by
|
||||||
/// the clients from the receiver.
|
/// the clients from the receiver.
|
||||||
priv tx: Sender<Signum>,
|
tx: Sender<Signum>,
|
||||||
|
|
||||||
/// Clients of Listener can `recv()` on this receiver. This is exposed to
|
/// Clients of Listener can `recv()` on this receiver. This is exposed to
|
||||||
/// allow selection over it as well as manipulation of the receiver
|
/// allow selection over it as well as manipulation of the receiver
|
||||||
/// directly.
|
/// directly.
|
||||||
rx: Receiver<Signum>,
|
pub rx: Receiver<Signum>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Listener {
|
impl Listener {
|
||||||
|
|
|
@ -293,7 +293,7 @@ pub fn println_args(fmt: &fmt::Arguments) {
|
||||||
|
|
||||||
/// Representation of a reader of a standard input stream
|
/// Representation of a reader of a standard input stream
|
||||||
pub struct StdReader {
|
pub struct StdReader {
|
||||||
priv inner: StdSource
|
inner: StdSource
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reader for StdReader {
|
impl Reader for StdReader {
|
||||||
|
@ -322,7 +322,7 @@ impl Reader for StdReader {
|
||||||
|
|
||||||
/// Representation of a writer to a standard output stream
|
/// Representation of a writer to a standard output stream
|
||||||
pub struct StdWriter {
|
pub struct StdWriter {
|
||||||
priv inner: StdSource
|
inner: StdSource
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StdWriter {
|
impl StdWriter {
|
||||||
|
|
|
@ -24,7 +24,7 @@ use sync::atomics;
|
||||||
/// A wrapper for a path to temporary directory implementing automatic
|
/// A wrapper for a path to temporary directory implementing automatic
|
||||||
/// scope-based deletion.
|
/// scope-based deletion.
|
||||||
pub struct TempDir {
|
pub struct TempDir {
|
||||||
priv path: Option<Path>
|
path: Option<Path>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TempDir {
|
impl TempDir {
|
||||||
|
|
|
@ -63,7 +63,7 @@ use rt::rtio::{IoFactory, LocalIo, RtioTimer};
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub struct Timer {
|
pub struct Timer {
|
||||||
priv obj: ~RtioTimer:Send,
|
obj: ~RtioTimer:Send,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sleep the current task for `msecs` milliseconds.
|
/// Sleep the current task for `msecs` milliseconds.
|
||||||
|
|
|
@ -17,8 +17,8 @@ use slice::bytes::MutableByteVector;
|
||||||
|
|
||||||
/// Wraps a `Reader`, limiting the number of bytes that can be read from it.
|
/// Wraps a `Reader`, limiting the number of bytes that can be read from it.
|
||||||
pub struct LimitReader<R> {
|
pub struct LimitReader<R> {
|
||||||
priv limit: uint,
|
limit: uint,
|
||||||
priv inner: R
|
inner: R
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Reader> LimitReader<R> {
|
impl<R: Reader> LimitReader<R> {
|
||||||
|
@ -85,7 +85,7 @@ impl Reader for NullReader {
|
||||||
|
|
||||||
/// A `Writer` which multiplexes writes to a set of `Writers`.
|
/// A `Writer` which multiplexes writes to a set of `Writers`.
|
||||||
pub struct MultiWriter {
|
pub struct MultiWriter {
|
||||||
priv writers: ~[~Writer]
|
writers: ~[~Writer]
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MultiWriter {
|
impl MultiWriter {
|
||||||
|
@ -118,8 +118,8 @@ impl Writer for MultiWriter {
|
||||||
/// A `Reader` which chains input from multiple `Readers`, reading each to
|
/// A `Reader` which chains input from multiple `Readers`, reading each to
|
||||||
/// completion before moving onto the next.
|
/// completion before moving onto the next.
|
||||||
pub struct ChainedReader<I, R> {
|
pub struct ChainedReader<I, R> {
|
||||||
priv readers: I,
|
readers: I,
|
||||||
priv cur_reader: Option<R>,
|
cur_reader: Option<R>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Reader, I: Iterator<R>> ChainedReader<I, R> {
|
impl<R: Reader, I: Iterator<R>> ChainedReader<I, R> {
|
||||||
|
@ -156,8 +156,8 @@ impl<R: Reader, I: Iterator<R>> Reader for ChainedReader<I, R> {
|
||||||
/// A `Reader` which forwards input from another `Reader`, passing it along to
|
/// A `Reader` which forwards input from another `Reader`, passing it along to
|
||||||
/// a `Writer` as well. Similar to the `tee(1)` command.
|
/// a `Writer` as well. Similar to the `tee(1)` command.
|
||||||
pub struct TeeReader<R, W> {
|
pub struct TeeReader<R, W> {
|
||||||
priv reader: R,
|
reader: R,
|
||||||
priv writer: W
|
writer: W,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Reader, W: Writer> TeeReader<R, W> {
|
impl<R: Reader, W: Writer> TeeReader<R, W> {
|
||||||
|
|
|
@ -751,7 +751,7 @@ impl<A, B, T: ExactSize<A>, U: ExactSize<B>> ExactSize<(A, B)> for Zip<T, U> {}
|
||||||
/// An double-ended iterator with the direction inverted
|
/// An double-ended iterator with the direction inverted
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Rev<T> {
|
pub struct Rev<T> {
|
||||||
priv iter: T
|
iter: T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: DoubleEndedIterator<A>> Iterator<A> for Rev<T> {
|
impl<A, T: DoubleEndedIterator<A>> Iterator<A> for Rev<T> {
|
||||||
|
@ -778,7 +778,7 @@ impl<A, T: DoubleEndedIterator<A> + RandomAccessIterator<A>> RandomAccessIterato
|
||||||
|
|
||||||
/// A mutable reference to an iterator
|
/// A mutable reference to an iterator
|
||||||
pub struct ByRef<'a, T> {
|
pub struct ByRef<'a, T> {
|
||||||
priv iter: &'a mut T
|
iter: &'a mut T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, T: Iterator<A>> Iterator<A> for ByRef<'a, T> {
|
impl<'a, A, T: Iterator<A>> Iterator<A> for ByRef<'a, T> {
|
||||||
|
@ -1036,8 +1036,8 @@ impl<A, T: Clone + Iterator<A>> CloneableIterator for T {
|
||||||
/// An iterator that repeats endlessly
|
/// An iterator that repeats endlessly
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Cycle<T> {
|
pub struct Cycle<T> {
|
||||||
priv orig: T,
|
orig: T,
|
||||||
priv iter: T,
|
iter: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> {
|
impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> {
|
||||||
|
@ -1087,9 +1087,9 @@ impl<A, T: Clone + RandomAccessIterator<A>> RandomAccessIterator<A> for Cycle<T>
|
||||||
/// An iterator which strings two iterators together
|
/// An iterator which strings two iterators together
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Chain<T, U> {
|
pub struct Chain<T, U> {
|
||||||
priv a: T,
|
a: T,
|
||||||
priv b: U,
|
b: U,
|
||||||
priv flag: bool
|
flag: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for Chain<T, U> {
|
impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for Chain<T, U> {
|
||||||
|
@ -1156,8 +1156,8 @@ for Chain<T, U> {
|
||||||
/// An iterator which iterates two other iterators simultaneously
|
/// An iterator which iterates two other iterators simultaneously
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Zip<T, U> {
|
pub struct Zip<T, U> {
|
||||||
priv a: T,
|
a: T,
|
||||||
priv b: U
|
b: U
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, B, T: Iterator<A>, U: Iterator<B>> Iterator<(A, B)> for Zip<T, U> {
|
impl<A, B, T: Iterator<A>, U: Iterator<B>> Iterator<(A, B)> for Zip<T, U> {
|
||||||
|
@ -1234,8 +1234,8 @@ RandomAccessIterator<(A, B)> for Zip<T, U> {
|
||||||
|
|
||||||
/// An iterator which maps the values of `iter` with `f`
|
/// An iterator which maps the values of `iter` with `f`
|
||||||
pub struct Map<'a, A, B, T> {
|
pub struct Map<'a, A, B, T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv f: 'a |A| -> B
|
f: 'a |A| -> B
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, B, T> Map<'a, A, B, T> {
|
impl<'a, A, B, T> Map<'a, A, B, T> {
|
||||||
|
@ -1283,8 +1283,8 @@ impl<'a, A, B, T: RandomAccessIterator<A>> RandomAccessIterator<B> for Map<'a, A
|
||||||
|
|
||||||
/// An iterator which filters the elements of `iter` with `predicate`
|
/// An iterator which filters the elements of `iter` with `predicate`
|
||||||
pub struct Filter<'a, A, T> {
|
pub struct Filter<'a, A, T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv predicate: 'a |&A| -> bool
|
predicate: 'a |&A| -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
|
impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
|
||||||
|
@ -1327,8 +1327,8 @@ impl<'a, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'a, A,
|
||||||
|
|
||||||
/// An iterator which uses `f` to both filter and map elements from `iter`
|
/// An iterator which uses `f` to both filter and map elements from `iter`
|
||||||
pub struct FilterMap<'a, A, B, T> {
|
pub struct FilterMap<'a, A, B, T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv f: 'a |A| -> Option<B>
|
f: 'a |A| -> Option<B>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'a, A, B, T> {
|
impl<'a, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'a, A, B, T> {
|
||||||
|
@ -1371,8 +1371,8 @@ for FilterMap<'a, A, B, T> {
|
||||||
/// An iterator which yields the current count and the element during iteration
|
/// An iterator which yields the current count and the element during iteration
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Enumerate<T> {
|
pub struct Enumerate<T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv count: uint
|
count: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: Iterator<A>> Iterator<(uint, A)> for Enumerate<T> {
|
impl<A, T: Iterator<A>> Iterator<(uint, A)> for Enumerate<T> {
|
||||||
|
@ -1425,8 +1425,8 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<(uint, A)> for Enumerat
|
||||||
|
|
||||||
/// An iterator with a `peek()` that returns an optional reference to the next element.
|
/// An iterator with a `peek()` that returns an optional reference to the next element.
|
||||||
pub struct Peekable<A, T> {
|
pub struct Peekable<A, T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv peeked: Option<A>,
|
peeked: Option<A>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
|
impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
|
||||||
|
@ -1475,9 +1475,9 @@ impl<'a, A, T: Iterator<A>> Peekable<A, T> {
|
||||||
|
|
||||||
/// An iterator which rejects elements while `predicate` is true
|
/// An iterator which rejects elements while `predicate` is true
|
||||||
pub struct SkipWhile<'a, A, T> {
|
pub struct SkipWhile<'a, A, T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv flag: bool,
|
flag: bool,
|
||||||
priv predicate: 'a |&A| -> bool
|
predicate: 'a |&A| -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
|
impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
|
||||||
|
@ -1513,9 +1513,9 @@ impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
|
||||||
|
|
||||||
/// An iterator which only accepts elements while `predicate` is true
|
/// An iterator which only accepts elements while `predicate` is true
|
||||||
pub struct TakeWhile<'a, A, T> {
|
pub struct TakeWhile<'a, A, T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv flag: bool,
|
flag: bool,
|
||||||
priv predicate: 'a |&A| -> bool
|
predicate: 'a |&A| -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
|
impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
|
||||||
|
@ -1548,8 +1548,8 @@ impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
|
||||||
/// An iterator which skips over `n` elements of `iter`.
|
/// An iterator which skips over `n` elements of `iter`.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Skip<T> {
|
pub struct Skip<T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv n: uint
|
n: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: Iterator<A>> Iterator<A> for Skip<T> {
|
impl<A, T: Iterator<A>> Iterator<A> for Skip<T> {
|
||||||
|
@ -1612,8 +1612,8 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Skip<T> {
|
||||||
/// An iterator which only iterates over the first `n` iterations of `iter`.
|
/// An iterator which only iterates over the first `n` iterations of `iter`.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Take<T> {
|
pub struct Take<T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv n: uint
|
n: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: Iterator<A>> Iterator<A> for Take<T> {
|
impl<A, T: Iterator<A>> Iterator<A> for Take<T> {
|
||||||
|
@ -1661,11 +1661,11 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<A> for Take<T> {
|
||||||
|
|
||||||
/// An iterator to maintain state while iterating another iterator
|
/// An iterator to maintain state while iterating another iterator
|
||||||
pub struct Scan<'a, A, B, T, St> {
|
pub struct Scan<'a, A, B, T, St> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv f: 'a |&mut St, A| -> Option<B>,
|
f: 'a |&mut St, A| -> Option<B>,
|
||||||
|
|
||||||
/// The current internal state to be passed to the closure next.
|
/// The current internal state to be passed to the closure next.
|
||||||
state: St
|
pub state: St,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
|
impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
|
||||||
|
@ -1685,10 +1685,10 @@ impl<'a, A, B, T: Iterator<A>, St> Iterator<B> for Scan<'a, A, B, T, St> {
|
||||||
/// and yields the elements of the produced iterators
|
/// and yields the elements of the produced iterators
|
||||||
///
|
///
|
||||||
pub struct FlatMap<'a, A, T, U> {
|
pub struct FlatMap<'a, A, T, U> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv f: 'a |A| -> U,
|
f: 'a |A| -> U,
|
||||||
priv frontiter: Option<U>,
|
frontiter: Option<U>,
|
||||||
priv backiter: Option<U>,
|
backiter: Option<U>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T, U> {
|
impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T, U> {
|
||||||
|
@ -1744,8 +1744,8 @@ impl<'a,
|
||||||
/// yields `None` once.
|
/// yields `None` once.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Fuse<T> {
|
pub struct Fuse<T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv done: bool
|
done: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, T: Iterator<A>> Iterator<A> for Fuse<T> {
|
impl<A, T: Iterator<A>> Iterator<A> for Fuse<T> {
|
||||||
|
@ -1816,8 +1816,8 @@ impl<T> Fuse<T> {
|
||||||
/// An iterator that calls a function with a reference to each
|
/// An iterator that calls a function with a reference to each
|
||||||
/// element before yielding it.
|
/// element before yielding it.
|
||||||
pub struct Inspect<'a, A, T> {
|
pub struct Inspect<'a, A, T> {
|
||||||
priv iter: T,
|
iter: T,
|
||||||
priv f: 'a |&A|
|
f: 'a |&A|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, T> Inspect<'a, A, T> {
|
impl<'a, A, T> Inspect<'a, A, T> {
|
||||||
|
@ -1869,9 +1869,9 @@ for Inspect<'a, A, T> {
|
||||||
|
|
||||||
/// An iterator which just modifies the contained state throughout iteration.
|
/// An iterator which just modifies the contained state throughout iteration.
|
||||||
pub struct Unfold<'a, A, St> {
|
pub struct Unfold<'a, A, St> {
|
||||||
priv f: 'a |&mut St| -> Option<A>,
|
f: 'a |&mut St| -> Option<A>,
|
||||||
/// Internal state that will be yielded on the next iteration
|
/// Internal state that will be yielded on the next iteration
|
||||||
state: St
|
pub state: St,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A, St> Unfold<'a, A, St> {
|
impl<'a, A, St> Unfold<'a, A, St> {
|
||||||
|
@ -1905,9 +1905,9 @@ impl<'a, A, St> Iterator<A> for Unfold<'a, A, St> {
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Counter<A> {
|
pub struct Counter<A> {
|
||||||
/// The current state the counter is at (next value to be yielded)
|
/// The current state the counter is at (next value to be yielded)
|
||||||
priv state: A,
|
state: A,
|
||||||
/// The amount that this iterator is stepping by
|
/// The amount that this iterator is stepping by
|
||||||
priv step: A
|
step: A,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new counter with the specified start/step
|
/// Creates a new counter with the specified start/step
|
||||||
|
@ -1933,9 +1933,9 @@ impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> {
|
||||||
/// An iterator over the range [start, stop)
|
/// An iterator over the range [start, stop)
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Range<A> {
|
pub struct Range<A> {
|
||||||
priv state: A,
|
state: A,
|
||||||
priv stop: A,
|
stop: A,
|
||||||
priv one: A
|
one: A
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator over the range [start, stop)
|
/// Return an iterator over the range [start, stop)
|
||||||
|
@ -2007,8 +2007,8 @@ impl<A: Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> {
|
||||||
/// An iterator over the range [start, stop]
|
/// An iterator over the range [start, stop]
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct RangeInclusive<A> {
|
pub struct RangeInclusive<A> {
|
||||||
priv range: Range<A>,
|
range: Range<A>,
|
||||||
priv done: bool
|
done: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator over the range [start, stop]
|
/// Return an iterator over the range [start, stop]
|
||||||
|
@ -2070,10 +2070,10 @@ impl<A: Sub<A, A> + Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A>
|
||||||
/// An iterator over the range [start, stop) by `step`. It handles overflow by stopping.
|
/// An iterator over the range [start, stop) by `step`. It handles overflow by stopping.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct RangeStep<A> {
|
pub struct RangeStep<A> {
|
||||||
priv state: A,
|
state: A,
|
||||||
priv stop: A,
|
stop: A,
|
||||||
priv step: A,
|
step: A,
|
||||||
priv rev: bool
|
rev: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping.
|
/// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping.
|
||||||
|
@ -2102,11 +2102,11 @@ impl<A: CheckedAdd + Ord + Clone> Iterator<A> for RangeStep<A> {
|
||||||
/// An iterator over the range [start, stop] by `step`. It handles overflow by stopping.
|
/// An iterator over the range [start, stop] by `step`. It handles overflow by stopping.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct RangeStepInclusive<A> {
|
pub struct RangeStepInclusive<A> {
|
||||||
priv state: A,
|
state: A,
|
||||||
priv stop: A,
|
stop: A,
|
||||||
priv step: A,
|
step: A,
|
||||||
priv rev: bool,
|
rev: bool,
|
||||||
priv done: bool
|
done: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
|
/// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
|
||||||
|
@ -2137,7 +2137,7 @@ impl<A: CheckedAdd + Ord + Clone + Eq> Iterator<A> for RangeStepInclusive<A> {
|
||||||
/// An iterator that repeats an element endlessly
|
/// An iterator that repeats an element endlessly
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Repeat<A> {
|
pub struct Repeat<A> {
|
||||||
priv element: A
|
element: A
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: Clone> Repeat<A> {
|
impl<A: Clone> Repeat<A> {
|
||||||
|
|
|
@ -193,7 +193,7 @@ pub mod marker {
|
||||||
/// "interior" mutability:
|
/// "interior" mutability:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// pub struct Cell<T> { priv value: T }
|
/// pub struct Cell<T> { value: T }
|
||||||
/// # fn main() {}
|
/// # fn main() {}
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
|
|
|
@ -57,7 +57,9 @@
|
||||||
// Don't link to std. We are std.
|
// Don't link to std. We are std.
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
#![deny(missing_doc)]
|
// #![deny(missing_doc)] // NOTE: uncomment after a stage0 snap
|
||||||
|
#![allow(missing_doc)] // NOTE: remove after a stage0 snap
|
||||||
|
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
|
||||||
|
|
||||||
// When testing libstd, bring in libuv as the I/O backend so tests can print
|
// When testing libstd, bring in libuv as the I/O backend so tests can print
|
||||||
// things and all of the std::io tests have an I/O interface to run on top
|
// things and all of the std::io tests have an I/O interface to run on top
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -535,7 +535,7 @@ impl<T> Default for Option<T> {
|
||||||
/// methods on `Option`.
|
/// methods on `Option`.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Item<A> {
|
pub struct Item<A> {
|
||||||
priv opt: Option<A>
|
opt: Option<A>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> Iterator<A> for Item<A> {
|
impl<A> Iterator<A> for Item<A> {
|
||||||
|
|
|
@ -370,10 +370,10 @@ pub fn unsetenv(n: &str) {
|
||||||
pub struct Pipe {
|
pub struct Pipe {
|
||||||
/// A file descriptor representing the reading end of the pipe. Data written
|
/// A file descriptor representing the reading end of the pipe. Data written
|
||||||
/// on the `out` file descriptor can be read from this file descriptor.
|
/// on the `out` file descriptor can be read from this file descriptor.
|
||||||
input: c_int,
|
pub input: c_int,
|
||||||
/// A file descriptor representing the write end of the pipe. Data written
|
/// A file descriptor representing the write end of the pipe. Data written
|
||||||
/// to this file descriptor can be read from the `input` file descriptor.
|
/// to this file descriptor can be read from the `input` file descriptor.
|
||||||
out: c_int,
|
pub out: c_int,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new low-level OS in-memory pipe.
|
/// Creates a new low-level OS in-memory pipe.
|
||||||
|
@ -946,11 +946,11 @@ pub fn page_size() -> uint {
|
||||||
/// let it leave scope by accident if you want it to stick around.
|
/// let it leave scope by accident if you want it to stick around.
|
||||||
pub struct MemoryMap {
|
pub struct MemoryMap {
|
||||||
/// Pointer to the memory created or modified by this map.
|
/// Pointer to the memory created or modified by this map.
|
||||||
data: *mut u8,
|
pub data: *mut u8,
|
||||||
/// Number of bytes this map applies to
|
/// Number of bytes this map applies to
|
||||||
len: uint,
|
pub len: uint,
|
||||||
/// Type of mapping
|
/// Type of mapping
|
||||||
kind: MemoryMapKind
|
pub kind: MemoryMapKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type of memory map
|
/// Type of memory map
|
||||||
|
|
|
@ -488,8 +488,8 @@ pub trait GenericPathUnsafe {
|
||||||
|
|
||||||
/// Helper struct for printing paths with format!()
|
/// Helper struct for printing paths with format!()
|
||||||
pub struct Display<'a, P> {
|
pub struct Display<'a, P> {
|
||||||
priv path: &'a P,
|
path: &'a P,
|
||||||
priv filename: bool
|
filename: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, P: GenericPath> fmt::Show for Display<'a, P> {
|
impl<'a, P: GenericPath> fmt::Show for Display<'a, P> {
|
||||||
|
|
|
@ -40,8 +40,8 @@ pub type RevStrComponents<'a> = Map<'a, &'a [u8], Option<&'a str>,
|
||||||
/// Represents a POSIX file path
|
/// Represents a POSIX file path
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
priv repr: ~[u8], // assumed to never be empty or contain NULs
|
repr: ~[u8], // assumed to never be empty or contain NULs
|
||||||
priv sepidx: Option<uint> // index of the final separator in repr
|
sepidx: Option<uint> // index of the final separator in repr
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The standard path separator character
|
/// The standard path separator character
|
||||||
|
|
|
@ -81,9 +81,9 @@ pub type RevComponents<'a> = Map<'a, Option<&'a str>, &'a [u8],
|
||||||
// preserved by the data structure; let the Windows API error out on them.
|
// preserved by the data structure; let the Windows API error out on them.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
priv repr: ~str, // assumed to never be empty
|
repr: ~str, // assumed to never be empty
|
||||||
priv prefix: Option<PathPrefix>,
|
prefix: Option<PathPrefix>,
|
||||||
priv sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr
|
sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for Path {
|
impl Eq for Path {
|
||||||
|
|
|
@ -21,18 +21,18 @@ use cast;
|
||||||
|
|
||||||
/// The representation of a Rust managed box
|
/// The representation of a Rust managed box
|
||||||
pub struct Box<T> {
|
pub struct Box<T> {
|
||||||
ref_count: uint,
|
pub ref_count: uint,
|
||||||
drop_glue: fn(ptr: *mut u8),
|
pub drop_glue: fn(ptr: *mut u8),
|
||||||
prev: *mut Box<T>,
|
pub prev: *mut Box<T>,
|
||||||
next: *mut Box<T>,
|
pub next: *mut Box<T>,
|
||||||
data: T
|
pub data: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The representation of a Rust vector
|
/// The representation of a Rust vector
|
||||||
pub struct Vec<T> {
|
pub struct Vec<T> {
|
||||||
fill: uint,
|
pub fill: uint,
|
||||||
alloc: uint,
|
pub alloc: uint,
|
||||||
data: T
|
pub data: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The representation of a Rust string
|
/// The representation of a Rust string
|
||||||
|
@ -40,20 +40,20 @@ pub type String = Vec<u8>;
|
||||||
|
|
||||||
/// The representation of a Rust slice
|
/// The representation of a Rust slice
|
||||||
pub struct Slice<T> {
|
pub struct Slice<T> {
|
||||||
data: *T,
|
pub data: *T,
|
||||||
len: uint
|
pub len: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The representation of a Rust closure
|
/// The representation of a Rust closure
|
||||||
pub struct Closure {
|
pub struct Closure {
|
||||||
code: *(),
|
pub code: *(),
|
||||||
env: *(),
|
pub env: *(),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The representation of a Rust procedure (`proc()`)
|
/// The representation of a Rust procedure (`proc()`)
|
||||||
pub struct Procedure {
|
pub struct Procedure {
|
||||||
code: *(),
|
pub code: *(),
|
||||||
env: *(),
|
pub env: *(),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The representation of a Rust trait object.
|
/// The representation of a Rust trait object.
|
||||||
|
@ -61,8 +61,8 @@ pub struct Procedure {
|
||||||
/// This struct does not have a `Repr` implementation
|
/// This struct does not have a `Repr` implementation
|
||||||
/// because there is no way to refer to all trait objects generically.
|
/// because there is no way to refer to all trait objects generically.
|
||||||
pub struct TraitObject {
|
pub struct TraitObject {
|
||||||
vtable: *(),
|
pub vtable: *(),
|
||||||
data: *(),
|
pub data: *(),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This trait is meant to map equivalences between raw structs and their
|
/// This trait is meant to map equivalences between raw structs and their
|
||||||
|
|
|
@ -43,9 +43,9 @@ struct RcBox<T> {
|
||||||
/// Immutable reference counted pointer type
|
/// Immutable reference counted pointer type
|
||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
pub struct Rc<T> {
|
pub struct Rc<T> {
|
||||||
priv ptr: *mut RcBox<T>,
|
ptr: *mut RcBox<T>,
|
||||||
priv nosend: marker::NoSend,
|
nosend: marker::NoSend,
|
||||||
priv noshare: marker::NoShare
|
noshare: marker::NoShare
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Rc<T> {
|
impl<T> Rc<T> {
|
||||||
|
@ -151,9 +151,9 @@ impl<T: TotalOrd> TotalOrd for Rc<T> {
|
||||||
/// Weak reference to a reference-counted box
|
/// Weak reference to a reference-counted box
|
||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
pub struct Weak<T> {
|
pub struct Weak<T> {
|
||||||
priv ptr: *mut RcBox<T>,
|
ptr: *mut RcBox<T>,
|
||||||
priv nosend: marker::NoSend,
|
nosend: marker::NoSend,
|
||||||
priv noshare: marker::NoShare
|
noshare: marker::NoShare
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Weak<T> {
|
impl<T> Weak<T> {
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub fn align(size: uint, align: uint) -> uint {
|
||||||
|
|
||||||
/// Adaptor to wrap around visitors implementing MovePtr.
|
/// Adaptor to wrap around visitors implementing MovePtr.
|
||||||
pub struct MovePtrAdaptor<V> {
|
pub struct MovePtrAdaptor<V> {
|
||||||
priv inner: V
|
inner: V
|
||||||
}
|
}
|
||||||
pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
|
pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
|
||||||
MovePtrAdaptor { inner: v }
|
MovePtrAdaptor { inner: v }
|
||||||
|
|
|
@ -101,11 +101,11 @@ enum VariantState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ReprVisitor<'a> {
|
pub struct ReprVisitor<'a> {
|
||||||
priv ptr: *u8,
|
ptr: *u8,
|
||||||
priv ptr_stk: ~[*u8],
|
ptr_stk: ~[*u8],
|
||||||
priv var_stk: ~[VariantState],
|
var_stk: ~[VariantState],
|
||||||
priv writer: &'a mut io::Writer,
|
writer: &'a mut io::Writer,
|
||||||
priv last_err: Option<io::IoError>,
|
last_err: Option<io::IoError>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ReprVisitor<'a>(ptr: *u8,
|
pub fn ReprVisitor<'a>(ptr: *u8,
|
||||||
|
|
|
@ -17,8 +17,7 @@ use libc;
|
||||||
|
|
||||||
#[cfg(not(target_arch = "arm"))]
|
#[cfg(not(target_arch = "arm"))]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub enum _Unwind_Action
|
pub enum _Unwind_Action {
|
||||||
{
|
|
||||||
_UA_SEARCH_PHASE = 1,
|
_UA_SEARCH_PHASE = 1,
|
||||||
_UA_CLEANUP_PHASE = 2,
|
_UA_CLEANUP_PHASE = 2,
|
||||||
_UA_HANDLER_FRAME = 4,
|
_UA_HANDLER_FRAME = 4,
|
||||||
|
@ -28,14 +27,13 @@ pub enum _Unwind_Action
|
||||||
|
|
||||||
#[cfg(target_arch = "arm")]
|
#[cfg(target_arch = "arm")]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub enum _Unwind_State
|
pub enum _Unwind_State {
|
||||||
{
|
_US_VIRTUAL_UNWIND_FRAME = 0,
|
||||||
_US_VIRTUAL_UNWIND_FRAME = 0,
|
_US_UNWIND_FRAME_STARTING = 1,
|
||||||
_US_UNWIND_FRAME_STARTING = 1,
|
_US_UNWIND_FRAME_RESUME = 2,
|
||||||
_US_UNWIND_FRAME_RESUME = 2,
|
_US_ACTION_MASK = 3,
|
||||||
_US_ACTION_MASK = 3,
|
_US_FORCE_UNWIND = 8,
|
||||||
_US_FORCE_UNWIND = 8,
|
_US_END_OF_STACK = 16
|
||||||
_US_END_OF_STACK = 16
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -69,9 +67,9 @@ pub static unwinder_private_data_size: int = 20;
|
||||||
pub static unwinder_private_data_size: int = 2;
|
pub static unwinder_private_data_size: int = 2;
|
||||||
|
|
||||||
pub struct _Unwind_Exception {
|
pub struct _Unwind_Exception {
|
||||||
exception_class: _Unwind_Exception_Class,
|
pub exception_class: _Unwind_Exception_Class,
|
||||||
exception_cleanup: _Unwind_Exception_Cleanup_Fn,
|
pub exception_cleanup: _Unwind_Exception_Cleanup_Fn,
|
||||||
private: [_Unwind_Word, ..unwinder_private_data_size],
|
pub private: [_Unwind_Word, ..unwinder_private_data_size],
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum _Unwind_Context {}
|
pub enum _Unwind_Context {}
|
||||||
|
|
|
@ -33,14 +33,14 @@ static MAGIC: u32 = 0xbadc0ffe;
|
||||||
pub type Box = raw::Box<()>;
|
pub type Box = raw::Box<()>;
|
||||||
|
|
||||||
pub struct MemoryRegion {
|
pub struct MemoryRegion {
|
||||||
priv allocations: Vec<*AllocHeader>,
|
allocations: Vec<*AllocHeader>,
|
||||||
priv live_allocations: uint,
|
live_allocations: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LocalHeap {
|
pub struct LocalHeap {
|
||||||
priv memory_region: MemoryRegion,
|
memory_region: MemoryRegion,
|
||||||
|
|
||||||
priv live_allocs: *mut raw::Box<()>,
|
live_allocs: *mut raw::Box<()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LocalHeap {
|
impl LocalHeap {
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub use self::compiled::*;
|
||||||
/// Encapsulates a borrowed value. When this value goes out of scope, the
|
/// Encapsulates a borrowed value. When this value goes out of scope, the
|
||||||
/// pointer is returned.
|
/// pointer is returned.
|
||||||
pub struct Borrowed<T> {
|
pub struct Borrowed<T> {
|
||||||
priv val: *(),
|
val: *(),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
|
|
@ -61,11 +61,11 @@ pub trait RemoteCallback {
|
||||||
/// libuv (it does translation to windows under the hood).
|
/// libuv (it does translation to windows under the hood).
|
||||||
pub struct FileOpenConfig {
|
pub struct FileOpenConfig {
|
||||||
/// Path to file to be opened
|
/// Path to file to be opened
|
||||||
path: Path,
|
pub path: Path,
|
||||||
/// Flags for file access mode (as per open(2))
|
/// Flags for file access mode (as per open(2))
|
||||||
flags: int,
|
pub flags: int,
|
||||||
/// File creation mode, ignored unless O_CREAT is passed as part of flags
|
/// File creation mode, ignored unless O_CREAT is passed as part of flags
|
||||||
priv mode: int
|
pub mode: int
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Description of what to do when a file handle is closed
|
/// Description of what to do when a file handle is closed
|
||||||
|
@ -83,7 +83,7 @@ pub enum CloseBehavior {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct LocalIo<'a> {
|
pub struct LocalIo<'a> {
|
||||||
priv factory: &'a mut IoFactory,
|
factory: &'a mut IoFactory,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
|
|
@ -43,18 +43,18 @@ use unstable::finally::Finally;
|
||||||
/// in the struct. This contains a pointer to another struct that holds
|
/// in the struct. This contains a pointer to another struct that holds
|
||||||
/// the type-specific state.
|
/// the type-specific state.
|
||||||
pub struct Task {
|
pub struct Task {
|
||||||
heap: LocalHeap,
|
pub heap: LocalHeap,
|
||||||
gc: GarbageCollector,
|
pub gc: GarbageCollector,
|
||||||
storage: LocalStorage,
|
pub storage: LocalStorage,
|
||||||
unwinder: Unwinder,
|
pub unwinder: Unwinder,
|
||||||
death: Death,
|
pub death: Death,
|
||||||
destroyed: bool,
|
pub destroyed: bool,
|
||||||
name: Option<SendStr>,
|
pub name: Option<SendStr>,
|
||||||
|
|
||||||
stdout: Option<~Writer:Send>,
|
pub stdout: Option<~Writer:Send>,
|
||||||
stderr: Option<~Writer:Send>,
|
pub stderr: Option<~Writer:Send>,
|
||||||
|
|
||||||
priv imp: Option<~Runtime:Send>,
|
imp: Option<~Runtime:Send>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct GarbageCollector;
|
pub struct GarbageCollector;
|
||||||
|
@ -77,11 +77,11 @@ pub enum DeathAction {
|
||||||
|
|
||||||
/// Per-task state related to task death, killing, failure, etc.
|
/// Per-task state related to task death, killing, failure, etc.
|
||||||
pub struct Death {
|
pub struct Death {
|
||||||
on_exit: Option<DeathAction>,
|
pub on_exit: Option<DeathAction>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BlockedTasks {
|
pub struct BlockedTasks {
|
||||||
priv inner: UnsafeArc<AtomicUint>,
|
inner: UnsafeArc<AtomicUint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Task {
|
impl Task {
|
||||||
|
|
|
@ -28,9 +28,9 @@ type StartFn = extern "C" fn(*libc::c_void) -> imp::rust_thread_return;
|
||||||
/// This struct represents a native thread's state. This is used to join on an
|
/// This struct represents a native thread's state. This is used to join on an
|
||||||
/// existing thread created in the join-able state.
|
/// existing thread created in the join-able state.
|
||||||
pub struct Thread<T> {
|
pub struct Thread<T> {
|
||||||
priv native: imp::rust_thread,
|
native: imp::rust_thread,
|
||||||
priv joined: bool,
|
joined: bool,
|
||||||
priv packet: ~Option<T>,
|
packet: ~Option<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEFAULT_STACK_SIZE: uint = 1024 * 1024;
|
static DEFAULT_STACK_SIZE: uint = 1024 * 1024;
|
||||||
|
|
|
@ -75,8 +75,8 @@ use intrinsics;
|
||||||
use uw = rt::libunwind;
|
use uw = rt::libunwind;
|
||||||
|
|
||||||
pub struct Unwinder {
|
pub struct Unwinder {
|
||||||
priv unwinding: bool,
|
unwinding: bool,
|
||||||
priv cause: Option<~Any:Send>
|
cause: Option<~Any:Send>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Unwinder {
|
impl Unwinder {
|
||||||
|
|
|
@ -233,10 +233,10 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
|
||||||
/// An iterator over the slices of a vector separated by elements that
|
/// An iterator over the slices of a vector separated by elements that
|
||||||
/// match a predicate function.
|
/// match a predicate function.
|
||||||
pub struct Splits<'a, T> {
|
pub struct Splits<'a, T> {
|
||||||
priv v: &'a [T],
|
v: &'a [T],
|
||||||
priv n: uint,
|
n: uint,
|
||||||
priv pred: 'a |t: &T| -> bool,
|
pred: 'a |t: &T| -> bool,
|
||||||
priv finished: bool
|
finished: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
|
impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
|
||||||
|
@ -282,10 +282,10 @@ impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
|
||||||
/// An iterator over the slices of a vector separated by elements that
|
/// An iterator over the slices of a vector separated by elements that
|
||||||
/// match a predicate function, from back to front.
|
/// match a predicate function, from back to front.
|
||||||
pub struct RevSplits<'a, T> {
|
pub struct RevSplits<'a, T> {
|
||||||
priv v: &'a [T],
|
v: &'a [T],
|
||||||
priv n: uint,
|
n: uint,
|
||||||
priv pred: 'a |t: &T| -> bool,
|
pred: 'a |t: &T| -> bool,
|
||||||
priv finished: bool
|
finished: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Iterator<&'a [T]> for RevSplits<'a, T> {
|
impl<'a, T> Iterator<&'a [T]> for RevSplits<'a, T> {
|
||||||
|
@ -411,9 +411,9 @@ pub fn unzip<T, U, V: Iterator<(T, U)>>(mut iter: V) -> (~[T], ~[U]) {
|
||||||
/// The last generated swap is always (0, 1), and it returns the
|
/// The last generated swap is always (0, 1), and it returns the
|
||||||
/// sequence to its initial order.
|
/// sequence to its initial order.
|
||||||
pub struct ElementSwaps {
|
pub struct ElementSwaps {
|
||||||
priv sdir: ~[SizeDirection],
|
sdir: ~[SizeDirection],
|
||||||
/// If true, emit the last swap that returns the sequence to initial state
|
/// If true, emit the last swap that returns the sequence to initial state
|
||||||
priv emit_reset: bool,
|
emit_reset: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ElementSwaps {
|
impl ElementSwaps {
|
||||||
|
@ -486,8 +486,8 @@ impl Iterator<(uint, uint)> for ElementSwaps {
|
||||||
///
|
///
|
||||||
/// Generates even and odd permutations alternately.
|
/// Generates even and odd permutations alternately.
|
||||||
pub struct Permutations<T> {
|
pub struct Permutations<T> {
|
||||||
priv swaps: ElementSwaps,
|
swaps: ElementSwaps,
|
||||||
priv v: ~[T],
|
v: ~[T],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone> Iterator<~[T]> for Permutations<T> {
|
impl<T: Clone> Iterator<~[T]> for Permutations<T> {
|
||||||
|
@ -508,8 +508,8 @@ impl<T: Clone> Iterator<~[T]> for Permutations<T> {
|
||||||
/// a vector.
|
/// a vector.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Windows<'a, T> {
|
pub struct Windows<'a, T> {
|
||||||
priv v: &'a [T],
|
v: &'a [T],
|
||||||
priv size: uint
|
size: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
|
impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
|
||||||
|
@ -542,8 +542,8 @@ impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
|
||||||
/// the last slice of the iteration will be the remainder.
|
/// the last slice of the iteration will be the remainder.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Chunks<'a, T> {
|
pub struct Chunks<'a, T> {
|
||||||
priv v: &'a [T],
|
v: &'a [T],
|
||||||
priv size: uint
|
size: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> {
|
impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> {
|
||||||
|
@ -2632,17 +2632,17 @@ impl<A> Default for ~[A] {
|
||||||
|
|
||||||
/// Immutable slice iterator
|
/// Immutable slice iterator
|
||||||
pub struct Items<'a, T> {
|
pub struct Items<'a, T> {
|
||||||
priv ptr: *T,
|
ptr: *T,
|
||||||
priv end: *T,
|
end: *T,
|
||||||
priv marker: marker::ContravariantLifetime<'a>
|
marker: marker::ContravariantLifetime<'a>
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mutable slice iterator
|
/// Mutable slice iterator
|
||||||
pub struct MutItems<'a, T> {
|
pub struct MutItems<'a, T> {
|
||||||
priv ptr: *mut T,
|
ptr: *mut T,
|
||||||
priv end: *mut T,
|
end: *mut T,
|
||||||
priv marker: marker::ContravariantLifetime<'a>,
|
marker: marker::ContravariantLifetime<'a>,
|
||||||
priv marker2: marker::NoCopy
|
marker2: marker::NoCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! iterator {
|
macro_rules! iterator {
|
||||||
|
@ -2735,9 +2735,9 @@ pub type RevMutItems<'a, T> = Rev<MutItems<'a, T>>;
|
||||||
/// An iterator over the subslices of the vector which are separated
|
/// An iterator over the subslices of the vector which are separated
|
||||||
/// by elements that match `pred`.
|
/// by elements that match `pred`.
|
||||||
pub struct MutSplits<'a, T> {
|
pub struct MutSplits<'a, T> {
|
||||||
priv v: &'a mut [T],
|
v: &'a mut [T],
|
||||||
priv pred: 'a |t: &T| -> bool,
|
pred: 'a |t: &T| -> bool,
|
||||||
priv finished: bool
|
finished: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> {
|
impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> {
|
||||||
|
@ -2800,8 +2800,8 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplits<'a, T> {
|
||||||
/// the vector len is not evenly divided by the chunk size, the last slice of the iteration will be
|
/// the vector len is not evenly divided by the chunk size, the last slice of the iteration will be
|
||||||
/// the remainder.
|
/// the remainder.
|
||||||
pub struct MutChunks<'a, T> {
|
pub struct MutChunks<'a, T> {
|
||||||
priv v: &'a mut [T],
|
v: &'a mut [T],
|
||||||
priv chunk_size: uint
|
chunk_size: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> {
|
impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> {
|
||||||
|
@ -2849,8 +2849,8 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> {
|
||||||
|
|
||||||
/// An iterator that moves out of a vector.
|
/// An iterator that moves out of a vector.
|
||||||
pub struct MoveItems<T> {
|
pub struct MoveItems<T> {
|
||||||
priv allocation: *mut u8, // the block of memory allocated for the vector
|
allocation: *mut u8, // the block of memory allocated for the vector
|
||||||
priv iter: Items<'static, T>
|
iter: Items<'static, T>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Iterator<T> for MoveItems<T> {
|
impl<T> Iterator<T> for MoveItems<T> {
|
||||||
|
|
|
@ -275,7 +275,7 @@ Section: Iterators
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Chars<'a> {
|
pub struct Chars<'a> {
|
||||||
/// The slice remaining to be iterated
|
/// The slice remaining to be iterated
|
||||||
priv string: &'a str,
|
string: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator<char> for Chars<'a> {
|
impl<'a> Iterator<char> for Chars<'a> {
|
||||||
|
@ -320,8 +320,8 @@ impl<'a> DoubleEndedIterator<char> for Chars<'a> {
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct CharOffsets<'a> {
|
pub struct CharOffsets<'a> {
|
||||||
/// The original string to be iterated
|
/// The original string to be iterated
|
||||||
priv string: &'a str,
|
string: &'a str,
|
||||||
priv iter: Chars<'a>,
|
iter: Chars<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator<(uint, char)> for CharOffsets<'a> {
|
impl<'a> Iterator<(uint, char)> for CharOffsets<'a> {
|
||||||
|
@ -371,12 +371,12 @@ pub type RevBytes<'a> = Rev<Bytes<'a>>;
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct CharSplits<'a, Sep> {
|
pub struct CharSplits<'a, Sep> {
|
||||||
/// The slice remaining to be iterated
|
/// The slice remaining to be iterated
|
||||||
priv string: &'a str,
|
string: &'a str,
|
||||||
priv sep: Sep,
|
sep: Sep,
|
||||||
/// Whether an empty string at the end is allowed
|
/// Whether an empty string at the end is allowed
|
||||||
priv allow_trailing_empty: bool,
|
allow_trailing_empty: bool,
|
||||||
priv only_ascii: bool,
|
only_ascii: bool,
|
||||||
priv finished: bool,
|
finished: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator over the substrings of a string, separated by `sep`,
|
/// An iterator over the substrings of a string, separated by `sep`,
|
||||||
|
@ -387,10 +387,10 @@ pub type RevCharSplits<'a, Sep> = Rev<CharSplits<'a, Sep>>;
|
||||||
/// splitting at most `count` times.
|
/// splitting at most `count` times.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct CharSplitsN<'a, Sep> {
|
pub struct CharSplitsN<'a, Sep> {
|
||||||
priv iter: CharSplits<'a, Sep>,
|
iter: CharSplits<'a, Sep>,
|
||||||
/// The number of splits remaining
|
/// The number of splits remaining
|
||||||
priv count: uint,
|
count: uint,
|
||||||
priv invert: bool,
|
invert: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator over the words of a string, separated by a sequence of whitespace
|
/// An iterator over the words of a string, separated by a sequence of whitespace
|
||||||
|
@ -503,18 +503,18 @@ impl<'a, Sep: CharEq> Iterator<&'a str> for CharSplitsN<'a, Sep> {
|
||||||
/// substring within a larger string
|
/// substring within a larger string
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct MatchIndices<'a> {
|
pub struct MatchIndices<'a> {
|
||||||
priv haystack: &'a str,
|
haystack: &'a str,
|
||||||
priv needle: &'a str,
|
needle: &'a str,
|
||||||
priv position: uint,
|
position: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An iterator over the substrings of a string separated by a given
|
/// An iterator over the substrings of a string separated by a given
|
||||||
/// search string
|
/// search string
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct StrSplits<'a> {
|
pub struct StrSplits<'a> {
|
||||||
priv it: MatchIndices<'a>,
|
it: MatchIndices<'a>,
|
||||||
priv last_end: uint,
|
last_end: uint,
|
||||||
priv finished: bool
|
finished: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator<(uint, uint)> for MatchIndices<'a> {
|
impl<'a> Iterator<(uint, uint)> for MatchIndices<'a> {
|
||||||
|
@ -597,10 +597,10 @@ enum NormalizationForm {
|
||||||
/// Use with the `std::iter` module.
|
/// Use with the `std::iter` module.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Normalizations<'a> {
|
pub struct Normalizations<'a> {
|
||||||
priv kind: NormalizationForm,
|
kind: NormalizationForm,
|
||||||
priv iter: Chars<'a>,
|
iter: Chars<'a>,
|
||||||
priv buffer: ~[(char, u8)],
|
buffer: ~[(char, u8)],
|
||||||
priv sorted: bool
|
sorted: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator<char> for Normalizations<'a> {
|
impl<'a> Iterator<char> for Normalizations<'a> {
|
||||||
|
@ -856,7 +856,7 @@ pub fn is_utf16(v: &[u16]) -> bool {
|
||||||
/// of `u16`s.
|
/// of `u16`s.
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct UTF16Items<'a> {
|
pub struct UTF16Items<'a> {
|
||||||
priv iter: slice::Items<'a, u16>
|
iter: slice::Items<'a, u16>
|
||||||
}
|
}
|
||||||
/// The possibilities for values decoded from a `u16` stream.
|
/// The possibilities for values decoded from a `u16` stream.
|
||||||
#[deriving(Eq, TotalEq, Clone, Show)]
|
#[deriving(Eq, TotalEq, Clone, Show)]
|
||||||
|
@ -1061,9 +1061,9 @@ pub fn utf8_char_width(b: u8) -> uint {
|
||||||
/// for iterating over the UTF-8 bytes of a string.
|
/// for iterating over the UTF-8 bytes of a string.
|
||||||
pub struct CharRange {
|
pub struct CharRange {
|
||||||
/// Current `char`
|
/// Current `char`
|
||||||
ch: char,
|
pub ch: char,
|
||||||
/// Index of the first byte of the next `char`
|
/// Index of the first byte of the next `char`
|
||||||
next: uint
|
pub next: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the initial codepoint accumulator for the first byte.
|
// Return the initial codepoint accumulator for the first byte.
|
||||||
|
|
|
@ -35,7 +35,7 @@ use ty::Unsafe;
|
||||||
/// Enforces no shared-memory safety.
|
/// Enforces no shared-memory safety.
|
||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
pub struct UnsafeArc<T> {
|
pub struct UnsafeArc<T> {
|
||||||
priv data: *mut ArcData<T>,
|
data: *mut ArcData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ArcData<T> {
|
struct ArcData<T> {
|
||||||
|
|
|
@ -116,26 +116,26 @@ use ty::Unsafe;
|
||||||
|
|
||||||
/// An atomic boolean type.
|
/// An atomic boolean type.
|
||||||
pub struct AtomicBool {
|
pub struct AtomicBool {
|
||||||
priv v: Unsafe<uint>,
|
v: Unsafe<uint>,
|
||||||
priv nocopy: marker::NoCopy
|
nocopy: marker::NoCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A signed atomic integer type, supporting basic atomic arithmetic operations
|
/// A signed atomic integer type, supporting basic atomic arithmetic operations
|
||||||
pub struct AtomicInt {
|
pub struct AtomicInt {
|
||||||
priv v: Unsafe<int>,
|
v: Unsafe<int>,
|
||||||
priv nocopy: marker::NoCopy
|
nocopy: marker::NoCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An unsigned atomic integer type, supporting basic atomic arithmetic operations
|
/// An unsigned atomic integer type, supporting basic atomic arithmetic operations
|
||||||
pub struct AtomicUint {
|
pub struct AtomicUint {
|
||||||
priv v: Unsafe<uint>,
|
v: Unsafe<uint>,
|
||||||
priv nocopy: marker::NoCopy
|
nocopy: marker::NoCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An unsafe atomic pointer. Only supports basic atomic operations
|
/// An unsafe atomic pointer. Only supports basic atomic operations
|
||||||
pub struct AtomicPtr<T> {
|
pub struct AtomicPtr<T> {
|
||||||
priv p: Unsafe<uint>,
|
p: Unsafe<uint>,
|
||||||
priv nocopy: marker::NoCopy
|
nocopy: marker::NoCopy
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An atomic, nullable unique pointer
|
/// An atomic, nullable unique pointer
|
||||||
|
@ -144,7 +144,7 @@ pub struct AtomicPtr<T> {
|
||||||
/// owned heap objects across tasks.
|
/// owned heap objects across tasks.
|
||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
pub struct AtomicOption<T> {
|
pub struct AtomicOption<T> {
|
||||||
priv p: Unsafe<uint>,
|
p: Unsafe<uint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Atomic memory orderings
|
/// Atomic memory orderings
|
||||||
|
|
|
@ -86,14 +86,14 @@ struct Deque<T> {
|
||||||
///
|
///
|
||||||
/// There may only be one worker per deque.
|
/// There may only be one worker per deque.
|
||||||
pub struct Worker<T> {
|
pub struct Worker<T> {
|
||||||
priv deque: UnsafeArc<Deque<T>>,
|
deque: UnsafeArc<Deque<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The stealing half of the work-stealing deque. Stealers have access to the
|
/// The stealing half of the work-stealing deque. Stealers have access to the
|
||||||
/// opposite end of the deque from the worker, and they only have access to the
|
/// opposite end of the deque from the worker, and they only have access to the
|
||||||
/// `steal` method.
|
/// `steal` method.
|
||||||
pub struct Stealer<T> {
|
pub struct Stealer<T> {
|
||||||
priv deque: UnsafeArc<Deque<T>>,
|
deque: UnsafeArc<Deque<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When stealing some data, this is an enumeration of the possible outcomes.
|
/// When stealing some data, this is an enumeration of the possible outcomes.
|
||||||
|
@ -116,7 +116,7 @@ pub enum Stolen<T> {
|
||||||
/// will only use this structure when allocating a new buffer or deallocating a
|
/// will only use this structure when allocating a new buffer or deallocating a
|
||||||
/// previous one.
|
/// previous one.
|
||||||
pub struct BufferPool<T> {
|
pub struct BufferPool<T> {
|
||||||
priv pool: Exclusive<~[~Buffer<T>]>,
|
pool: Exclusive<~[~Buffer<T>]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An internal buffer used by the chase-lev deque. This structure is actually
|
/// An internal buffer used by the chase-lev deque. This structure is actually
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct State<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Queue<T> {
|
pub struct Queue<T> {
|
||||||
priv state: UnsafeArc<State<T>>,
|
state: UnsafeArc<State<T>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Send> State<T> {
|
impl<T: Send> State<T> {
|
||||||
|
|
|
@ -67,8 +67,8 @@ struct Node<T> {
|
||||||
/// may be safely shared so long as it is guaranteed that there is only one
|
/// may be safely shared so long as it is guaranteed that there is only one
|
||||||
/// popper at a time (many pushers are allowed).
|
/// popper at a time (many pushers are allowed).
|
||||||
pub struct Queue<T> {
|
pub struct Queue<T> {
|
||||||
priv head: AtomicPtr<Node<T>>,
|
head: AtomicPtr<Node<T>>,
|
||||||
priv tail: *mut Node<T>,
|
tail: *mut Node<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Node<T> {
|
impl<T> Node<T> {
|
||||||
|
|
|
@ -55,19 +55,19 @@ struct Node<T> {
|
||||||
/// time.
|
/// time.
|
||||||
pub struct Queue<T> {
|
pub struct Queue<T> {
|
||||||
// consumer fields
|
// consumer fields
|
||||||
priv tail: *mut Node<T>, // where to pop from
|
tail: *mut Node<T>, // where to pop from
|
||||||
priv tail_prev: AtomicPtr<Node<T>>, // where to pop from
|
tail_prev: AtomicPtr<Node<T>>, // where to pop from
|
||||||
|
|
||||||
// producer fields
|
// producer fields
|
||||||
priv head: *mut Node<T>, // where to push to
|
head: *mut Node<T>, // where to push to
|
||||||
priv first: *mut Node<T>, // where to get new nodes from
|
first: *mut Node<T>, // where to get new nodes from
|
||||||
priv tail_copy: *mut Node<T>, // between first/tail
|
tail_copy: *mut Node<T>, // between first/tail
|
||||||
|
|
||||||
// Cache maintenance fields. Additions and subtractions are stored
|
// Cache maintenance fields. Additions and subtractions are stored
|
||||||
// separately in order to allow them to use nonatomic addition/subtraction.
|
// separately in order to allow them to use nonatomic addition/subtraction.
|
||||||
priv cache_bound: uint,
|
cache_bound: uint,
|
||||||
priv cache_additions: AtomicUint,
|
cache_additions: AtomicUint,
|
||||||
priv cache_subtractions: AtomicUint,
|
cache_subtractions: AtomicUint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Send> Node<T> {
|
impl<T: Send> Node<T> {
|
||||||
|
|
|
@ -60,15 +60,15 @@ pub type TaskResult = Result<(), ~Any:Send>;
|
||||||
/// Task configuration options
|
/// Task configuration options
|
||||||
pub struct TaskOpts {
|
pub struct TaskOpts {
|
||||||
/// Enable lifecycle notifications on the given channel
|
/// Enable lifecycle notifications on the given channel
|
||||||
notify_chan: Option<Sender<TaskResult>>,
|
pub notify_chan: Option<Sender<TaskResult>>,
|
||||||
/// A name for the task-to-be, for identification in failure messages
|
/// A name for the task-to-be, for identification in failure messages
|
||||||
name: Option<SendStr>,
|
pub name: Option<SendStr>,
|
||||||
/// The size of the stack for the spawned task
|
/// The size of the stack for the spawned task
|
||||||
stack_size: Option<uint>,
|
pub stack_size: Option<uint>,
|
||||||
/// Task-local stdout
|
/// Task-local stdout
|
||||||
stdout: Option<~Writer:Send>,
|
pub stdout: Option<~Writer:Send>,
|
||||||
/// Task-local stderr
|
/// Task-local stderr
|
||||||
stderr: Option<~Writer:Send>,
|
pub stderr: Option<~Writer:Send>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,9 +85,9 @@ pub struct TaskOpts {
|
||||||
// the run function move them in.
|
// the run function move them in.
|
||||||
pub struct TaskBuilder {
|
pub struct TaskBuilder {
|
||||||
/// Options to spawn the new task with
|
/// Options to spawn the new task with
|
||||||
opts: TaskOpts,
|
pub opts: TaskOpts,
|
||||||
priv gen_body: Option<proc:Send(v: proc:Send()) -> proc:Send()>,
|
gen_body: Option<proc:Send(v: proc:Send()) -> proc:Send()>,
|
||||||
priv nocopy: Option<marker::NoCopy>,
|
nocopy: Option<marker::NoCopy>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,10 +48,10 @@ use kinds::marker;
|
||||||
#[lang="unsafe"]
|
#[lang="unsafe"]
|
||||||
pub struct Unsafe<T> {
|
pub struct Unsafe<T> {
|
||||||
/// Wrapped value
|
/// Wrapped value
|
||||||
value: T,
|
pub value: T,
|
||||||
|
|
||||||
/// Invariance marker
|
/// Invariance marker
|
||||||
marker1: marker::InvariantType<T>
|
pub marker1: marker::InvariantType<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Unsafe<T> {
|
impl<T> Unsafe<T> {
|
||||||
|
|
|
@ -22,7 +22,7 @@ use ops::*;
|
||||||
use option::*;
|
use option::*;
|
||||||
use result::*;
|
use result::*;
|
||||||
|
|
||||||
pub struct DynamicLibrary { priv handle: *u8}
|
pub struct DynamicLibrary { handle: *u8}
|
||||||
|
|
||||||
impl Drop for DynamicLibrary {
|
impl Drop for DynamicLibrary {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ use ops::Drop;
|
||||||
/// Prefer the `NativeMutex` type where possible, since that does not
|
/// Prefer the `NativeMutex` type where possible, since that does not
|
||||||
/// require manual deallocation.
|
/// require manual deallocation.
|
||||||
pub struct StaticNativeMutex {
|
pub struct StaticNativeMutex {
|
||||||
priv inner: imp::Mutex,
|
inner: imp::Mutex,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A native mutex with a destructor for clean-up.
|
/// A native mutex with a destructor for clean-up.
|
||||||
|
@ -75,7 +75,7 @@ pub struct StaticNativeMutex {
|
||||||
/// See `StaticNativeMutex` for a version that is suitable for storing in
|
/// See `StaticNativeMutex` for a version that is suitable for storing in
|
||||||
/// statics.
|
/// statics.
|
||||||
pub struct NativeMutex {
|
pub struct NativeMutex {
|
||||||
priv inner: StaticNativeMutex
|
inner: StaticNativeMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Automatically unlocks the mutex that it was created from on
|
/// Automatically unlocks the mutex that it was created from on
|
||||||
|
@ -86,7 +86,7 @@ pub struct NativeMutex {
|
||||||
/// then.
|
/// then.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub struct LockGuard<'a> {
|
pub struct LockGuard<'a> {
|
||||||
priv lock: &'a StaticNativeMutex
|
lock: &'a StaticNativeMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static NATIVE_MUTEX_INIT: StaticNativeMutex = StaticNativeMutex {
|
pub static NATIVE_MUTEX_INIT: StaticNativeMutex = StaticNativeMutex {
|
||||||
|
@ -372,8 +372,8 @@ mod imp {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Mutex {
|
pub struct Mutex {
|
||||||
priv lock: Unsafe<pthread_mutex_t>,
|
lock: Unsafe<pthread_mutex_t>,
|
||||||
priv cond: Unsafe<pthread_cond_t>,
|
cond: Unsafe<pthread_cond_t>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static MUTEX_INIT: Mutex = Mutex {
|
pub static MUTEX_INIT: Mutex = Mutex {
|
||||||
|
@ -447,8 +447,8 @@ mod imp {
|
||||||
|
|
||||||
pub struct Mutex {
|
pub struct Mutex {
|
||||||
// pointers for the lock/cond handles, atomically updated
|
// pointers for the lock/cond handles, atomically updated
|
||||||
priv lock: atomics::AtomicUint,
|
lock: atomics::AtomicUint,
|
||||||
priv cond: atomics::AtomicUint,
|
cond: atomics::AtomicUint,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static MUTEX_INIT: Mutex = Mutex {
|
pub static MUTEX_INIT: Mutex = Mutex {
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct ExData<T> {
|
||||||
* need to block or deschedule while accessing shared state, use extra::sync::RWArc.
|
* need to block or deschedule while accessing shared state, use extra::sync::RWArc.
|
||||||
*/
|
*/
|
||||||
pub struct Exclusive<T> {
|
pub struct Exclusive<T> {
|
||||||
priv x: UnsafeArc<ExData<T>>
|
x: UnsafeArc<ExData<T>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Send> Clone for Exclusive<T> {
|
impl<T:Send> Clone for Exclusive<T> {
|
||||||
|
|
|
@ -56,9 +56,9 @@ use slice::{MutableTotalOrdVector, Vector};
|
||||||
/// ```
|
/// ```
|
||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
pub struct Vec<T> {
|
pub struct Vec<T> {
|
||||||
priv len: uint,
|
len: uint,
|
||||||
priv cap: uint,
|
cap: uint,
|
||||||
priv ptr: *mut T
|
ptr: *mut T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Vec<T> {
|
impl<T> Vec<T> {
|
||||||
|
@ -1308,8 +1308,8 @@ impl<T:fmt::Show> fmt::Show for Vec<T> {
|
||||||
|
|
||||||
/// An iterator that moves out of a vector.
|
/// An iterator that moves out of a vector.
|
||||||
pub struct MoveItems<T> {
|
pub struct MoveItems<T> {
|
||||||
priv allocation: *mut c_void, // the block of memory allocated for the vector
|
allocation: *mut c_void, // the block of memory allocated for the vector
|
||||||
priv iter: Items<'static, T>
|
iter: Items<'static, T>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Iterator<T> for MoveItems<T> {
|
impl<T> Iterator<T> for MoveItems<T> {
|
||||||
|
|
Loading…
Reference in New Issue