/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)]
-pub struct Ascii { priv chr: u8 }
+pub struct Ascii { chr: u8 }
impl Ascii {
/// Converts an ascii character into a `u8`.
/// This structure wraps a `*libc::c_char`, and will automatically free the
/// memory it is pointing to when it goes out of scope.
pub struct CString {
- priv buf: *libc::c_char,
- priv owns_buffer_: bool,
+ buf: *libc::c_char,
+ owns_buffer_: bool,
}
impl Clone for CString {
///
/// Use with the `std::iter` module.
pub struct CChars<'a> {
- priv ptr: *libc::c_char,
- priv marker: marker::ContravariantLifetime<'a>,
+ ptr: *libc::c_char,
+ marker: marker::ContravariantLifetime<'a>,
}
impl<'a> Iterator<libc::c_char> for CChars<'a> {
/// The type representing a foreign chunk of memory
pub struct CVec<T> {
- priv base: *mut T,
- priv len: uint,
- priv dtor: Option<proc:Send()>,
+ base: *mut T,
+ len: uint,
+ dtor: Option<proc:Send()>,
}
#[unsafe_destructor]
/// A mutable memory location that admits only `Copy` data.
pub struct Cell<T> {
- priv value: Unsafe<T>,
- priv noshare: marker::NoShare,
+ value: Unsafe<T>,
+ noshare: marker::NoShare,
}
impl<T:Copy> Cell<T> {
/// A mutable memory location with dynamically checked borrow rules
pub struct RefCell<T> {
- priv value: Unsafe<T>,
- priv borrow: BorrowFlag,
- priv nocopy: marker::NoCopy,
- priv noshare: marker::NoShare,
+ value: Unsafe<T>,
+ borrow: BorrowFlag,
+ nocopy: marker::NoCopy,
+ noshare: marker::NoShare,
}
// Values [1, MAX-1] represent the number of `Ref` active
/// Wraps a borrowed reference to a value in a `RefCell` box.
pub struct Ref<'b, T> {
- priv parent: &'b RefCell<T>
+ parent: &'b RefCell<T>
}
#[unsafe_destructor]
/// Wraps a mutable borrowed reference to a value in a `RefCell` box.
pub struct RefMut<'b, T> {
- priv parent: &'b mut RefCell<T>
+ parent: &'b mut RefCell<T>
}
#[unsafe_destructor]
/// The receiving-half of Rust's channel type. This half can only be owned by
/// one task
pub struct Receiver<T> {
- priv inner: Flavor<T>,
- priv receives: Cell<uint>,
+ inner: Flavor<T>,
+ receives: Cell<uint>,
// can't share in an arc
- priv marker: marker::NoShare,
+ marker: marker::NoShare,
}
/// An iterator over messages on a receiver, this iterator will block
/// whenever `next` is called, waiting for a new message, and `None` will be
/// returned when the corresponding channel has hung up.
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
/// owned by one task, but it can be cloned to send to other tasks.
pub struct Sender<T> {
- priv inner: Flavor<T>,
- priv sends: Cell<uint>,
+ inner: Flavor<T>,
+ sends: Cell<uint>,
// 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
/// owned by one task, but it can be cloned to send to other tasks.
pub struct SyncSender<T> {
- priv inner: UnsafeArc<sync::Packet<T>>,
+ inner: UnsafeArc<sync::Packet<T>>,
// 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
/// The "receiver set" of the select interface. This structure is used to manage
/// a set of receivers which are being selected over.
pub struct Select {
- priv head: *mut Handle<'static, ()>,
- priv tail: *mut Handle<'static, ()>,
- priv next_id: Cell<uint>,
- priv marker1: marker::NoSend,
+ head: *mut Handle<'static, ()>,
+ tail: *mut Handle<'static, ()>,
+ next_id: Cell<uint>,
+ marker1: marker::NoSend,
}
/// A handle to a receiver which is currently a member of a `Select` set of
pub struct Handle<'rx, T> {
/// The ID of this handle, used to compare against the return value of
/// `Select::wait()`
- priv id: uint,
- priv selector: &'rx Select,
- priv next: *mut Handle<'static, ()>,
- priv prev: *mut Handle<'static, ()>,
- priv added: bool,
- priv packet: &'rx Packet,
+ id: uint,
+ selector: &'rx Select,
+ next: *mut Handle<'static, ()>,
+ prev: *mut Handle<'static, ()>,
+ added: bool,
+ packet: &'rx Packet,
// due to our fun transmutes, we be sure to place this at the end. (nothing
// previous relies on T)
- priv rx: &'rx Receiver<T>,
+ rx: &'rx Receiver<T>,
}
struct Packets { cur: *mut Handle<'static, ()> }
/// traits.
pub struct Formatter<'a> {
/// Flags for formatting (packed version of rt::Flag)
- flags: uint,
+ pub flags: uint,
/// Character used as 'fill' whenever there is alignment
- fill: char,
+ pub fill: char,
/// 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
- width: Option<uint>,
+ pub width: Option<uint>,
/// Optionally specified precision for numeric types
- precision: Option<uint>,
+ pub precision: Option<uint>,
/// Output buffer.
- buf: &'a mut io::Writer,
- priv curarg: slice::Items<'a, Argument<'a>>,
- priv args: &'a [Argument<'a>],
+ pub buf: &'a mut io::Writer,
+ curarg: slice::Items<'a, Argument<'a>>,
+ args: &'a [Argument<'a>],
}
/// This struct represents the generic "argument" which is taken by the Xprintf
/// 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.
pub struct Argument<'a> {
- priv formatter: extern "Rust" fn(&any::Void, &mut Formatter) -> Result,
- priv value: &'a any::Void,
+ formatter: extern "Rust" fn(&any::Void, &mut Formatter) -> Result,
+ value: &'a any::Void,
}
impl<'a> Arguments<'a> {
/// string at compile-time so usage of the `write` and `format` functions can
/// be safely performed.
pub struct Arguments<'a> {
- priv fmt: &'a [rt::Piece<'a>],
- priv args: &'a [Argument<'a>],
+ fmt: &'a [rt::Piece<'a>],
+ args: &'a [Argument<'a>],
}
/// When a format is not otherwise specified, types are formatted by ascribing
/// A radix with in the range of `2..36`.
#[deriving(Clone, Eq)]
pub struct Radix {
- priv base: u8,
+ base: u8,
}
impl Radix {
#[deriving(Eq)]
pub struct Argument<'a> {
/// Where to find this argument
- position: Position<'a>,
+ pub position: Position<'a>,
/// How to format the argument
- format: FormatSpec<'a>,
+ pub format: FormatSpec<'a>,
/// If not `None`, what method to invoke on the argument
- method: Option<~Method<'a>>
+ pub method: Option<~Method<'a>>
}
/// Specification for the formatting of an argument in the format string.
#[deriving(Eq)]
pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with
- fill: Option<char>,
+ pub fill: Option<char>,
/// Optionally specified alignment
- align: Alignment,
+ pub align: Alignment,
/// Packed version of various flags provided
- flags: uint,
+ pub flags: uint,
/// The integer precision to use
- precision: Count<'a>,
+ pub precision: Count<'a>,
/// The string width requested for the resulting format
- width: Count<'a>,
+ pub width: Count<'a>,
/// The descriptor string representing the name of the format desired for
/// this argument, this can be empty or any number of characters, although
/// it is required to be one word.
- ty: &'a str
+ pub ty: &'a str
}
/// Enum describing where an argument for a format can be located.
pub struct PluralArm<'a> {
/// A selector can either be specified by a keyword or with an integer
/// literal.
- selector: PluralSelector,
+ pub selector: PluralSelector,
/// Array of pieces which are the format of this arm
- result: ~[Piece<'a>],
+ pub result: ~[Piece<'a>],
}
/// Enum of the 5 CLDR plural keywords. There is one more, "other", but that
#[deriving(Eq)]
pub struct SelectArm<'a> {
/// String selector which guards this arm
- selector: &'a str,
+ pub selector: &'a str,
/// Array of pieces which are the format of this arm
- result: ~[Piece<'a>],
+ pub result: ~[Piece<'a>],
}
/// The parser structure for interpreting the input format string. This is
/// This is a recursive-descent parser for the sake of simplicity, and if
/// necessary there's probably lots of room for improvement performance-wise.
pub struct Parser<'a> {
- priv input: &'a str,
- priv cur: str::CharOffsets<'a>,
- priv depth: uint,
+ input: &'a str,
+ cur: str::CharOffsets<'a>,
+ depth: uint,
/// Error messages accumulated during parsing
- errors: ~[~str],
+ pub errors: ~[~str],
}
impl<'a> Iterator<Piece<'a>> for Parser<'a> {
}
pub struct Argument<'a> {
- position: Position,
- format: FormatSpec,
- method: Option<&'a Method<'a>>
+ pub position: Position,
+ pub format: FormatSpec,
+ pub method: Option<&'a Method<'a>>
}
pub struct FormatSpec {
- fill: char,
- align: parse::Alignment,
- flags: uint,
- precision: Count,
- width: Count,
+ pub fill: char,
+ pub align: parse::Alignment,
+ pub flags: uint,
+ pub precision: Count,
+ pub width: Count,
}
pub enum Count {
}
pub struct PluralArm<'a> {
- selector: PluralSelector,
- result: &'a [Piece<'a>],
+ pub selector: PluralSelector,
+ pub result: &'a [Piece<'a>],
}
pub struct SelectArm<'a> {
- selector: &'a str,
- result: &'a [Piece<'a>],
+ pub selector: &'a str,
+ pub result: &'a [Piece<'a>],
}
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."]
pub struct Gc<T> {
- priv ptr: @T,
- priv marker: marker::NoSend,
+ ptr: @T,
+ marker: marker::NoSend,
}
#[cfg(test)]
pub struct Gc<T> {
- priv ptr: @T,
- priv marker: marker::NoSend,
+ ptr: @T,
+ marker: marker::NoSend,
}
impl<T: 'static> Gc<T> {
/// `SipState` computes a SipHash 2-4 hash over a stream of bytes.
pub struct SipState {
- priv k0: u64,
- priv k1: u64,
- priv length: uint, // how many bytes we've processed
- priv v0: u64, // hash state
- priv v1: u64,
- priv v2: u64,
- priv v3: u64,
- priv tail: [u8, ..8], // unprocessed bytes
- priv ntail: uint, // how many bytes in tail are valid
+ k0: u64,
+ k1: u64,
+ length: uint, // how many bytes we've processed
+ v0: u64, // hash state
+ v1: u64,
+ v2: u64,
+ v3: u64,
+ tail: [u8, ..8], // unprocessed bytes
+ ntail: uint, // how many bytes in tail are valid
}
// sadly, these macro definitions can't appear later,
/// `SipHasher` computes the SipHash algorithm from a stream of bytes.
#[deriving(Clone)]
pub struct SipHasher {
- priv k0: u64,
- priv k1: u64,
+ k0: u64,
+ k1: u64,
}
impl SipHasher {
#[cfg(not(test))]
pub struct TyDesc {
// sizeof(T)
- size: uint,
+ pub size: uint,
// alignof(T)
- align: uint,
+ pub align: uint,
// 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`
- visit_glue: GlueFn,
+ pub visit_glue: GlueFn,
// Name corresponding to the type
- name: &'static str
+ pub name: &'static str,
}
#[lang="opaque"]
#[deriving(Eq, Hash, Show, TotalEq)]
#[cfg(not(test))]
pub struct TypeId {
- priv t: u64,
+ t: u64,
}
#[cfg(not(test))]
/// }
/// ```
pub struct BufferedReader<R> {
- priv inner: R,
- priv buf: Vec<u8>,
- priv pos: uint,
- priv cap: uint,
+ inner: R,
+ buf: Vec<u8>,
+ pos: uint,
+ cap: uint,
}
impl<R: Reader> BufferedReader<R> {
/// writer.flush();
/// ```
pub struct BufferedWriter<W> {
- priv inner: Option<W>,
- priv buf: Vec<u8>,
- priv pos: uint
+ inner: Option<W>,
+ buf: Vec<u8>,
+ pos: uint
}
impl<W: Writer> BufferedWriter<W> {
///
/// This writer will be flushed when it is dropped.
pub struct LineBufferedWriter<W> {
- priv inner: BufferedWriter<W>,
+ inner: BufferedWriter<W>,
}
impl<W: Writer> LineBufferedWriter<W> {
/// }
/// ```
pub struct BufferedStream<S> {
- priv inner: BufferedReader<InternalBufferedWriter<S>>
+ inner: BufferedReader<InternalBufferedWriter<S>>
}
impl<S: Stream> BufferedStream<S> {
/// A dummy reader intended at testing short-reads propagation.
pub struct ShortReader {
- priv lengths: ~[uint],
+ lengths: ~[uint],
}
impl Reader for ShortReader {
/// }
/// ```
pub struct ChanReader {
- priv buf: Option<~[u8]>, // A buffer of bytes received but not consumed.
- priv pos: uint, // How many of the buffered bytes have already be consumed.
- priv rx: Receiver<~[u8]>, // The rx to pull data from.
- priv closed: bool, // Whether the pipe this rx connects to has been closed.
+ buf: Option<~[u8]>, // A buffer of bytes received but not consumed.
+ pos: uint, // How many of the buffered bytes have already be consumed.
+ rx: Receiver<~[u8]>, // The rx to pull data from.
+ closed: bool, // Whether the pipe this rx connects to has been closed.
}
impl ChanReader {
/// writer.write("hello, world".as_bytes());
/// ```
pub struct ChanWriter {
- priv tx: Sender<~[u8]>,
+ tx: Sender<~[u8]>,
}
impl ChanWriter {
/// Any error other than `EndOfFile` that is produced by the underlying Reader
/// is returned by the iterator and should be handled by the caller.
pub struct Bytes<'r, T> {
- priv reader: &'r mut T,
+ reader: &'r mut T,
}
impl<'r, R: Reader> Bytes<'r, R> {
/// configured at creation time, via the `FileAccess` parameter to
/// `File::open_mode()`.
pub struct File {
- priv fd: ~RtioFileStream:Send,
- priv path: Path,
- priv last_nread: int,
+ fd: ~RtioFileStream:Send,
+ path: Path,
+ last_nread: int,
}
impl File {
/// An iterator which walks over a directory
pub struct Directories {
- priv stack: ~[Path],
+ stack: ~[Path],
}
impl Iterator<Path> for Directories {
/// assert_eq!(w.unwrap(), ~[0, 1, 2]);
/// ```
pub struct MemWriter {
- priv buf: ~[u8],
- priv pos: uint,
+ buf: ~[u8],
+ pos: uint,
}
impl MemWriter {
/// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2]);
/// ```
pub struct MemReader {
- priv buf: ~[u8],
- priv pos: uint
+ buf: ~[u8],
+ pos: uint
}
impl MemReader {
/// assert!(buf == [0, 1, 2, 0]);
/// ```
pub struct BufWriter<'a> {
- priv buf: &'a mut [u8],
- priv pos: uint
+ buf: &'a mut [u8],
+ pos: uint
}
impl<'a> BufWriter<'a> {
/// assert_eq!(r.read_to_end().unwrap(), ~[0, 1, 2, 3]);
/// ```
pub struct BufReader<'a> {
- priv buf: &'a [u8],
- priv pos: uint
+ buf: &'a [u8],
+ pos: uint
}
impl<'a> BufReader<'a> {
pub struct IoError {
/// An enumeration which can be matched against for determining the flavor
/// of error.
- kind: IoErrorKind,
+ pub kind: IoErrorKind,
/// A human-readable description about the error
- desc: &'static str,
+ pub desc: &'static str,
/// Detailed information about this error, not always available
- detail: Option<~str>
+ pub detail: Option<~str>
}
impl fmt::Show for IoError {
/// Any error other than `EndOfFile` that is produced by the underlying Reader
/// is returned by the iterator and should be handled by the caller.
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> {
/// Any error other than `EndOfFile` that is produced by the underlying Reader
/// is returned by the iterator and should be handled by the caller.
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> {
/// connection attempt was successful. A successful connection will be wrapped
/// in `Ok`. A failed connection is represented as an `Err`.
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> {
#[deriving(Hash)]
pub struct FileStat {
/// The path that this stat structure is describing
- path: Path,
+ pub path: Path,
/// The size of the file, in bytes
- size: u64,
+ pub size: u64,
/// The kind of file this path points to (directory, file, pipe, etc.)
- kind: FileType,
+ pub kind: FileType,
/// The file permissions currently on the file
- perm: FilePermission,
+ pub perm: FilePermission,
// FIXME(#10301): These time fields are pretty useless without an actual
// time representation, what are the milliseconds relative
/// The time that the file was created at, in platform-dependent
/// milliseconds
- created: u64,
+ pub created: u64,
/// The time that this file was last modified, in platform-dependent
/// milliseconds
- modified: u64,
+ pub modified: u64,
/// The time that this file was last accessed, in platform-dependent
/// milliseconds
- accessed: u64,
+ pub accessed: u64,
/// Information returned by stat() which is not guaranteed to be
/// platform-independent. This information may be useful on some platforms,
/// Usage of this field is discouraged, but if access is desired then the
/// fields are located here.
#[unstable]
- unstable: UnstableFileStat,
+ pub unstable: UnstableFileStat,
}
/// This structure represents all of the possible information which can be
#[deriving(Hash)]
pub struct UnstableFileStat {
/// The ID of the device containing the file.
- device: u64,
+ pub device: u64,
/// The file serial number.
- inode: u64,
+ pub inode: u64,
/// The device ID.
- rdev: u64,
+ pub rdev: u64,
/// The number of hard links to this file.
- nlink: u64,
+ pub nlink: u64,
/// The user ID of the file.
- uid: u64,
+ pub uid: u64,
/// The group ID of the file.
- gid: u64,
+ pub gid: u64,
/// The optimal block size for I/O.
- blksize: u64,
+ pub blksize: u64,
/// The blocks allocated for this file.
- blocks: u64,
+ pub blocks: u64,
/// User-defined flags for the file.
- flags: u64,
+ pub flags: u64,
/// The file generation number.
- gen: u64,
+ pub gen: u64,
}
/// A set of permissions for a file or directory is represented by a set of
/// For details on these fields, see their corresponding definitions via
/// `man -s 3 getaddrinfo`
pub struct Hint {
- family: uint,
- socktype: Option<SocketType>,
- protocol: Option<Protocol>,
- flags: uint,
+ pub family: uint,
+ pub socktype: Option<SocketType>,
+ pub protocol: Option<Protocol>,
+ pub flags: uint,
}
pub struct Info {
- address: SocketAddr,
- family: uint,
- socktype: Option<SocketType>,
- protocol: Option<Protocol>,
- flags: uint,
+ pub address: SocketAddr,
+ pub family: uint,
+ pub socktype: Option<SocketType>,
+ pub protocol: Option<Protocol>,
+ pub flags: uint,
}
/// Easy name resolution. Given a hostname, returns the list of IP addresses for
#[deriving(Eq, TotalEq, Clone, Hash)]
pub struct SocketAddr {
- ip: IpAddr,
- port: Port,
+ pub ip: IpAddr,
+ pub port: Port,
}
impl fmt::Show for SocketAddr {
//! A TCP connection implements the `Reader` and `Writer` traits, while the TCP
//! listener (socket server) implements the `Listener` and `Acceptor` traits.
-#![deny(missing_doc)]
-
use clone::Clone;
use io::IoResult;
use io::net::ip::SocketAddr;
/// drop(stream); // close the connection
/// ```
pub struct TcpStream {
- priv obj: ~RtioTcpStream:Send
+ obj: ~RtioTcpStream:Send
}
impl TcpStream {
/// # }
/// ```
pub struct TcpListener {
- priv obj: ~RtioTcpListener:Send
+ obj: ~RtioTcpListener:Send
}
impl TcpListener {
/// a `TcpListener`'s `listen` method, and this object can be used to accept new
/// `TcpStream` instances.
pub struct TcpAcceptor {
- priv obj: ~RtioTcpAcceptor:Send
+ obj: ~RtioTcpAcceptor:Send
}
impl Acceptor<TcpStream> for TcpAcceptor {
/// drop(socket); // close the socket
/// ```
pub struct UdpSocket {
- priv obj: ~RtioUdpSocket:Send
+ obj: ~RtioUdpSocket:Send
}
impl UdpSocket {
/// A type that allows convenient usage of a UDP stream connected to one
/// address via the `Reader` and `Writer` traits.
pub struct UdpStream {
- priv socket: UdpSocket,
- priv connected_to: SocketAddr
+ socket: UdpSocket,
+ connected_to: SocketAddr
}
impl UdpStream {
/// A stream which communicates over a named pipe.
pub struct UnixStream {
- priv obj: PipeStream,
+ obj: PipeStream,
}
impl UnixStream {
/// A value that can listen for incoming named pipe connection requests.
pub struct UnixListener {
/// The internal, opaque runtime Unix listener.
- priv obj: ~RtioUnixListener:Send,
+ obj: ~RtioUnixListener:Send,
}
impl UnixListener {
/// A value that can accept named pipe connections, returned from `listen()`.
pub struct UnixAcceptor {
/// The internal, opaque runtime Unix acceptor.
- priv obj: ~RtioUnixAcceptor:Send,
+ obj: ~RtioUnixAcceptor:Send,
}
impl Acceptor<UnixStream> for UnixAcceptor {
/// A synchronous, in-memory pipe.
pub struct PipeStream {
/// The internal, opaque runtime pipe object.
- priv obj: ~RtioPipe:Send,
+ obj: ~RtioPipe:Send,
}
impl PipeStream {
//! Bindings for executing child processes
-#![deny(missing_doc)]
-
use prelude::*;
use fmt;
/// assert!(child.wait().success());
/// ```
pub struct Process {
- priv handle: ~RtioProcess:Send,
+ handle: ~RtioProcess:Send,
/// Handle to the child's stdin, if the `stdin` field of this process's
/// `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
/// `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
/// `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
/// 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
/// ```
pub struct ProcessConfig<'a> {
/// 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)
- args: &'a [~str],
+ pub args: &'a [~str],
/// Optional environment to specify for the program. If this is None, then
/// 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
/// 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).
/// This field defaults to `CreatePipe(true, false)` so the input can be
/// written to.
- stdin: StdioContainer,
+ pub stdin: StdioContainer,
/// Configuration for the child process's stdout handle (file descriptor 1).
/// This field defaults to `CreatePipe(false, true)` so the output can be
/// collected.
- stdout: StdioContainer,
+ pub stdout: StdioContainer,
/// Configuration for the child process's stdout handle (file descriptor 2).
/// This field defaults to `CreatePipe(false, true)` so the output can be
/// collected.
- stderr: StdioContainer,
+ pub stderr: StdioContainer,
/// Any number of streams/file descriptors/pipes may be attached to this
/// process. This list enumerates the file descriptors and such for the
/// 3 and go to the length of this array. The first three file descriptors
/// (stdin/stdout/stderr) are configured with the `stdin`, `stdout`, and
/// `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
/// 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.
- uid: Option<uint>,
+ pub uid: Option<uint>,
/// Similar to `uid`, but sets the group id of the child process. This has
/// 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
/// means that the child is the leader of a new process group.
- detach: bool,
+ pub detach: bool,
}
/// The output of a finished process.
pub struct ProcessOutput {
/// The status (exit code) of the process.
- status: ProcessExit,
+ pub status: ProcessExit,
/// The data that the process wrote to stdout.
- output: ~[u8],
+ pub output: ~[u8],
/// 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.
/// ```
pub struct Listener {
/// 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
/// the clients from the receiver.
- priv tx: Sender<Signum>,
+ tx: Sender<Signum>,
/// Clients of Listener can `recv()` on this receiver. This is exposed to
/// allow selection over it as well as manipulation of the receiver
/// directly.
- rx: Receiver<Signum>,
+ pub rx: Receiver<Signum>,
}
impl Listener {
/// Representation of a reader of a standard input stream
pub struct StdReader {
- priv inner: StdSource
+ inner: StdSource
}
impl Reader for StdReader {
/// Representation of a writer to a standard output stream
pub struct StdWriter {
- priv inner: StdSource
+ inner: StdSource
}
impl StdWriter {
/// A wrapper for a path to temporary directory implementing automatic
/// scope-based deletion.
pub struct TempDir {
- priv path: Option<Path>
+ path: Option<Path>
}
impl TempDir {
/// # }
/// ```
pub struct Timer {
- priv obj: ~RtioTimer:Send,
+ obj: ~RtioTimer:Send,
}
/// Sleep the current task for `msecs` milliseconds.
/// Wraps a `Reader`, limiting the number of bytes that can be read from it.
pub struct LimitReader<R> {
- priv limit: uint,
- priv inner: R
+ limit: uint,
+ inner: R
}
impl<R: Reader> LimitReader<R> {
/// A `Writer` which multiplexes writes to a set of `Writers`.
pub struct MultiWriter {
- priv writers: ~[~Writer]
+ writers: ~[~Writer]
}
impl MultiWriter {
/// A `Reader` which chains input from multiple `Readers`, reading each to
/// completion before moving onto the next.
pub struct ChainedReader<I, R> {
- priv readers: I,
- priv cur_reader: Option<R>,
+ readers: I,
+ cur_reader: Option<R>,
}
impl<R: Reader, I: Iterator<R>> ChainedReader<I, R> {
/// A `Reader` which forwards input from another `Reader`, passing it along to
/// a `Writer` as well. Similar to the `tee(1)` command.
pub struct TeeReader<R, W> {
- priv reader: R,
- priv writer: W
+ reader: R,
+ writer: W,
}
impl<R: Reader, W: Writer> TeeReader<R, W> {
/// An double-ended iterator with the direction inverted
#[deriving(Clone)]
pub struct Rev<T> {
- priv iter: T
+ iter: T
}
impl<A, T: DoubleEndedIterator<A>> Iterator<A> for Rev<T> {
/// A mutable reference to an iterator
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> {
/// An iterator that repeats endlessly
#[deriving(Clone)]
pub struct Cycle<T> {
- priv orig: T,
- priv iter: T,
+ orig: T,
+ iter: T,
}
impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> {
/// An iterator which strings two iterators together
#[deriving(Clone)]
pub struct Chain<T, U> {
- priv a: T,
- priv b: U,
- priv flag: bool
+ a: T,
+ b: U,
+ flag: bool
}
impl<A, T: Iterator<A>, U: Iterator<A>> Iterator<A> for Chain<T, U> {
/// An iterator which iterates two other iterators simultaneously
#[deriving(Clone)]
pub struct Zip<T, U> {
- priv a: T,
- priv b: U
+ a: T,
+ b: U
}
impl<A, B, T: Iterator<A>, U: Iterator<B>> Iterator<(A, B)> for Zip<T, U> {
/// An iterator which maps the values of `iter` with `f`
pub struct Map<'a, A, B, T> {
- priv iter: T,
- priv f: 'a |A| -> B
+ iter: T,
+ f: 'a |A| -> B
}
impl<'a, A, B, T> Map<'a, A, B, T> {
/// An iterator which filters the elements of `iter` with `predicate`
pub struct Filter<'a, A, T> {
- priv iter: T,
- priv predicate: 'a |&A| -> bool
+ iter: T,
+ predicate: 'a |&A| -> bool
}
impl<'a, A, T: Iterator<A>> Iterator<A> for Filter<'a, A, T> {
/// An iterator which uses `f` to both filter and map elements from `iter`
pub struct FilterMap<'a, A, B, T> {
- priv iter: T,
- priv f: 'a |A| -> Option<B>
+ iter: T,
+ f: 'a |A| -> Option<B>
}
impl<'a, A, B, T: Iterator<A>> Iterator<B> for FilterMap<'a, A, B, T> {
/// An iterator which yields the current count and the element during iteration
#[deriving(Clone)]
pub struct Enumerate<T> {
- priv iter: T,
- priv count: uint
+ iter: T,
+ count: uint
}
impl<A, T: Iterator<A>> Iterator<(uint, A)> for Enumerate<T> {
/// An iterator with a `peek()` that returns an optional reference to the next element.
pub struct Peekable<A, T> {
- priv iter: T,
- priv peeked: Option<A>,
+ iter: T,
+ peeked: Option<A>,
}
impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
/// An iterator which rejects elements while `predicate` is true
pub struct SkipWhile<'a, A, T> {
- priv iter: T,
- priv flag: bool,
- priv predicate: 'a |&A| -> bool
+ iter: T,
+ flag: bool,
+ predicate: 'a |&A| -> bool
}
impl<'a, A, T: Iterator<A>> Iterator<A> for SkipWhile<'a, A, T> {
/// An iterator which only accepts elements while `predicate` is true
pub struct TakeWhile<'a, A, T> {
- priv iter: T,
- priv flag: bool,
- priv predicate: 'a |&A| -> bool
+ iter: T,
+ flag: bool,
+ predicate: 'a |&A| -> bool
}
impl<'a, A, T: Iterator<A>> Iterator<A> for TakeWhile<'a, A, T> {
/// An iterator which skips over `n` elements of `iter`.
#[deriving(Clone)]
pub struct Skip<T> {
- priv iter: T,
- priv n: uint
+ iter: T,
+ n: uint
}
impl<A, T: Iterator<A>> Iterator<A> for Skip<T> {
/// An iterator which only iterates over the first `n` iterations of `iter`.
#[deriving(Clone)]
pub struct Take<T> {
- priv iter: T,
- priv n: uint
+ iter: T,
+ n: uint
}
impl<A, T: Iterator<A>> Iterator<A> for Take<T> {
/// An iterator to maintain state while iterating another iterator
pub struct Scan<'a, A, B, T, St> {
- priv iter: T,
- priv f: 'a |&mut St, A| -> Option<B>,
+ iter: T,
+ f: 'a |&mut St, A| -> Option<B>,
/// 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> {
/// and yields the elements of the produced iterators
///
pub struct FlatMap<'a, A, T, U> {
- priv iter: T,
- priv f: 'a |A| -> U,
- priv frontiter: Option<U>,
- priv backiter: Option<U>,
+ iter: T,
+ f: 'a |A| -> U,
+ frontiter: Option<U>,
+ backiter: Option<U>,
}
impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T, U> {
/// yields `None` once.
#[deriving(Clone)]
pub struct Fuse<T> {
- priv iter: T,
- priv done: bool
+ iter: T,
+ done: bool
}
impl<A, T: Iterator<A>> Iterator<A> for Fuse<T> {
/// An iterator that calls a function with a reference to each
/// element before yielding it.
pub struct Inspect<'a, A, T> {
- priv iter: T,
- priv f: 'a |&A|
+ iter: T,
+ f: 'a |&A|
}
impl<'a, A, T> Inspect<'a, A, T> {
/// An iterator which just modifies the contained state throughout iteration.
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
- state: St
+ pub state: St,
}
impl<'a, A, St> Unfold<'a, A, St> {
#[deriving(Clone)]
pub struct Counter<A> {
/// 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
- priv step: A
+ step: A,
}
/// Creates a new counter with the specified start/step
/// An iterator over the range [start, stop)
#[deriving(Clone)]
pub struct Range<A> {
- priv state: A,
- priv stop: A,
- priv one: A
+ state: A,
+ stop: A,
+ one: A
}
/// Return an iterator over the range [start, stop)
/// An iterator over the range [start, stop]
#[deriving(Clone)]
pub struct RangeInclusive<A> {
- priv range: Range<A>,
- priv done: bool
+ range: Range<A>,
+ done: bool,
}
/// Return an iterator over the range [start, stop]
/// An iterator over the range [start, stop) by `step`. It handles overflow by stopping.
#[deriving(Clone)]
pub struct RangeStep<A> {
- priv state: A,
- priv stop: A,
- priv step: A,
- priv rev: bool
+ state: A,
+ stop: A,
+ step: A,
+ rev: bool,
}
/// Return 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)]
pub struct RangeStepInclusive<A> {
- priv state: A,
- priv stop: A,
- priv step: A,
- priv rev: bool,
- priv done: bool
+ state: A,
+ stop: A,
+ step: A,
+ rev: bool,
+ done: bool,
}
/// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
/// An iterator that repeats an element endlessly
#[deriving(Clone)]
pub struct Repeat<A> {
- priv element: A
+ element: A
}
impl<A: Clone> Repeat<A> {
/// "interior" mutability:
///
/// ```
- /// pub struct Cell<T> { priv value: T }
+ /// pub struct Cell<T> { value: T }
/// # fn main() {}
/// ```
///
// Don't link to std. We are 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
// things and all of the std::io tests have an I/O interface to run on top
pub type pthread_t = c_ulong;
pub struct glob_t {
- gl_pathc: size_t,
- gl_pathv: **c_char,
- gl_offs: size_t,
-
- __unused1: *c_void,
- __unused2: *c_void,
- __unused3: *c_void,
- __unused4: *c_void,
- __unused5: *c_void,
+ pub gl_pathc: size_t,
+ pub gl_pathv: **c_char,
+ pub gl_offs: size_t,
+
+ pub __unused1: *c_void,
+ pub __unused2: *c_void,
+ pub __unused3: *c_void,
+ pub __unused4: *c_void,
+ pub __unused5: *c_void,
}
pub struct timeval {
- tv_sec: time_t,
- tv_usec: suseconds_t,
+ pub tv_sec: time_t,
+ pub tv_usec: suseconds_t,
}
pub struct timespec {
- tv_sec: time_t,
- tv_nsec: c_long,
+ pub tv_sec: time_t,
+ pub tv_nsec: c_long,
}
pub enum timezone {}
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub struct sockaddr {
- sa_family: sa_family_t,
- sa_data: [u8, ..14],
+ pub sa_family: sa_family_t,
+ pub sa_data: [u8, ..14],
}
pub struct sockaddr_storage {
- ss_family: sa_family_t,
- __ss_align: i64,
- __ss_pad2: [u8, ..112],
+ pub ss_family: sa_family_t,
+ pub __ss_align: i64,
+ pub __ss_pad2: [u8, ..112],
}
pub struct sockaddr_in {
- sin_family: sa_family_t,
- sin_port: in_port_t,
- sin_addr: in_addr,
- sin_zero: [u8, ..8],
+ pub sin_family: sa_family_t,
+ pub sin_port: in_port_t,
+ pub sin_addr: in_addr,
+ pub sin_zero: [u8, ..8],
}
pub struct in_addr {
- s_addr: in_addr_t,
+ pub s_addr: in_addr_t,
}
pub struct sockaddr_in6 {
- sin6_family: sa_family_t,
- sin6_port: in_port_t,
- sin6_flowinfo: u32,
- sin6_addr: in6_addr,
- sin6_scope_id: u32,
+ pub sin6_family: sa_family_t,
+ pub sin6_port: in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: in6_addr,
+ pub sin6_scope_id: u32,
}
pub struct in6_addr {
- s6_addr: [u16, ..8]
+ pub s6_addr: [u16, ..8]
}
pub struct ip_mreq {
- imr_multiaddr: in_addr,
- imr_interface: in_addr,
+ pub imr_multiaddr: in_addr,
+ pub imr_interface: in_addr,
}
pub struct ip6_mreq {
- ipv6mr_multiaddr: in6_addr,
- ipv6mr_interface: c_uint,
+ pub ipv6mr_multiaddr: in6_addr,
+ pub ipv6mr_interface: c_uint,
}
pub struct addrinfo {
- ai_flags: c_int,
- ai_family: c_int,
- ai_socktype: c_int,
- ai_protocol: c_int,
- ai_addrlen: socklen_t,
- ai_addr: *sockaddr,
- ai_canonname: *c_char,
- ai_next: *addrinfo
+ pub ai_flags: c_int,
+ pub ai_family: c_int,
+ pub ai_socktype: c_int,
+ pub ai_protocol: c_int,
+ pub ai_addrlen: socklen_t,
+ pub ai_addr: *sockaddr,
+ pub ai_canonname: *c_char,
+ pub ai_next: *addrinfo,
}
pub struct sockaddr_un {
- sun_family: sa_family_t,
- sun_path: [c_char, ..108]
+ pub sun_family: sa_family_t,
+ pub sun_path: [c_char, ..108]
}
}
}
pub type blkcnt_t = i32;
pub struct stat {
- st_dev: dev_t,
- __pad1: c_short,
- st_ino: ino_t,
- st_mode: mode_t,
- st_nlink: nlink_t,
- st_uid: uid_t,
- st_gid: gid_t,
- st_rdev: dev_t,
- __pad2: c_short,
- st_size: off_t,
- st_blksize: blksize_t,
- st_blocks: blkcnt_t,
- st_atime: time_t,
- st_atime_nsec: c_long,
- st_mtime: time_t,
- st_mtime_nsec: c_long,
- st_ctime: time_t,
- st_ctime_nsec: c_long,
- __unused4: c_long,
- __unused5: c_long,
+ pub st_dev: dev_t,
+ pub __pad1: c_short,
+ pub st_ino: ino_t,
+ pub st_mode: mode_t,
+ pub st_nlink: nlink_t,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub st_rdev: dev_t,
+ pub __pad2: c_short,
+ pub st_size: off_t,
+ pub st_blksize: blksize_t,
+ pub st_blocks: blkcnt_t,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub __unused4: c_long,
+ pub __unused5: c_long,
}
pub struct utimbuf {
- actime: time_t,
- modtime: time_t,
+ pub actime: time_t,
+ pub modtime: time_t,
}
pub struct pthread_attr_t {
- __size: [u32, ..9]
+ pub __size: [u32, ..9]
}
}
#[cfg(target_arch = "arm")]
pub type blkcnt_t = u32;
pub struct stat {
- st_dev: c_ulonglong,
- __pad0: [c_uchar, ..4],
- __st_ino: ino_t,
- st_mode: c_uint,
- st_nlink: c_uint,
- st_uid: uid_t,
- st_gid: gid_t,
- st_rdev: c_ulonglong,
- __pad3: [c_uchar, ..4],
- st_size: c_longlong,
- st_blksize: blksize_t,
- st_blocks: c_ulonglong,
- st_atime: time_t,
- st_atime_nsec: c_ulong,
- st_mtime: time_t,
- st_mtime_nsec: c_ulong,
- st_ctime: time_t,
- st_ctime_nsec: c_ulong,
- st_ino: c_ulonglong
+ pub st_dev: c_ulonglong,
+ pub __pad0: [c_uchar, ..4],
+ pub __st_ino: ino_t,
+ pub st_mode: c_uint,
+ pub st_nlink: c_uint,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub st_rdev: c_ulonglong,
+ pub __pad3: [c_uchar, ..4],
+ pub st_size: c_longlong,
+ pub st_blksize: blksize_t,
+ pub st_blocks: c_ulonglong,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_ulong,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_ulong,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_ulong,
+ pub st_ino: c_ulonglong,
}
pub struct utimbuf {
- actime: time_t,
- modtime: time_t,
+ pub actime: time_t,
+ pub modtime: time_t,
}
pub struct pthread_attr_t {
- __size: [u32, ..9]
+ pub __size: [u32, ..9]
}
}
#[cfg(target_arch = "mips")]
pub type blkcnt_t = i32;
pub struct stat {
- st_dev: c_ulong,
- st_pad1: [c_long, ..3],
- st_ino: ino_t,
- st_mode: mode_t,
- st_nlink: nlink_t,
- st_uid: uid_t,
- st_gid: gid_t,
- st_rdev: c_ulong,
- st_pad2: [c_long, ..2],
- st_size: off_t,
- st_pad3: c_long,
- st_atime: time_t,
- st_atime_nsec: c_long,
- st_mtime: time_t,
- st_mtime_nsec: c_long,
- st_ctime: time_t,
- st_ctime_nsec: c_long,
- st_blksize: blksize_t,
- st_blocks: blkcnt_t,
- st_pad5: [c_long, ..14],
+ pub st_dev: c_ulong,
+ pub st_pad1: [c_long, ..3],
+ pub st_ino: ino_t,
+ pub st_mode: mode_t,
+ pub st_nlink: nlink_t,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub st_rdev: c_ulong,
+ pub st_pad2: [c_long, ..2],
+ pub st_size: off_t,
+ pub st_pad3: c_long,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub st_blksize: blksize_t,
+ pub st_blocks: blkcnt_t,
+ pub st_pad5: [c_long, ..14],
}
pub struct utimbuf {
- actime: time_t,
- modtime: time_t,
+ pub actime: time_t,
+ pub modtime: time_t,
}
pub struct pthread_attr_t {
- __size: [u32, ..9]
+ pub __size: [u32, ..9]
}
}
pub mod posix08 {}
pub type blksize_t = i64;
pub type blkcnt_t = i64;
pub struct stat {
- st_dev: dev_t,
- st_ino: ino_t,
- st_nlink: nlink_t,
- st_mode: mode_t,
- st_uid: uid_t,
- st_gid: gid_t,
- __pad0: c_int,
- st_rdev: dev_t,
- st_size: off_t,
- st_blksize: blksize_t,
- st_blocks: blkcnt_t,
- st_atime: time_t,
- st_atime_nsec: c_long,
- st_mtime: time_t,
- st_mtime_nsec: c_long,
- st_ctime: time_t,
- st_ctime_nsec: c_long,
- __unused: [c_long, ..3],
+ pub st_dev: dev_t,
+ pub st_ino: ino_t,
+ pub st_nlink: nlink_t,
+ pub st_mode: mode_t,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub __pad0: c_int,
+ pub st_rdev: dev_t,
+ pub st_size: off_t,
+ pub st_blksize: blksize_t,
+ pub st_blocks: blkcnt_t,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub __unused: [c_long, ..3],
}
pub struct utimbuf {
- actime: time_t,
- modtime: time_t,
+ pub actime: time_t,
+ pub modtime: time_t,
}
pub struct pthread_attr_t {
- __size: [u64, ..7]
+ pub __size: [u64, ..7]
}
}
pub mod posix08 {
pub type pthread_t = uintptr_t;
pub struct glob_t {
- gl_pathc: size_t,
- __unused1: size_t,
- gl_offs: size_t,
- __unused2: c_int,
- gl_pathv: **c_char,
-
- __unused3: *c_void,
-
- __unused4: *c_void,
- __unused5: *c_void,
- __unused6: *c_void,
- __unused7: *c_void,
- __unused8: *c_void,
+ pub gl_pathc: size_t,
+ pub __unused1: size_t,
+ pub gl_offs: size_t,
+ pub __unused2: c_int,
+ pub gl_pathv: **c_char,
+
+ pub __unused3: *c_void,
+
+ pub __unused4: *c_void,
+ pub __unused5: *c_void,
+ pub __unused6: *c_void,
+ pub __unused7: *c_void,
+ pub __unused8: *c_void,
}
pub struct timeval {
- tv_sec: time_t,
- tv_usec: suseconds_t,
+ pub tv_sec: time_t,
+ pub tv_usec: suseconds_t,
}
pub struct timespec {
- tv_sec: time_t,
- tv_nsec: c_long,
+ pub tv_sec: time_t,
+ pub tv_nsec: c_long,
}
pub enum timezone {}
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub struct sockaddr {
- sa_len: u8,
- sa_family: sa_family_t,
- sa_data: [u8, ..14],
+ pub sa_len: u8,
+ pub sa_family: sa_family_t,
+ pub sa_data: [u8, ..14],
}
pub struct sockaddr_storage {
- ss_len: u8,
- ss_family: sa_family_t,
- __ss_pad1: [u8, ..6],
- __ss_align: i64,
- __ss_pad2: [u8, ..112],
+ pub ss_len: u8,
+ pub ss_family: sa_family_t,
+ pub __ss_pad1: [u8, ..6],
+ pub __ss_align: i64,
+ pub __ss_pad2: [u8, ..112],
}
pub struct sockaddr_in {
- sin_len: u8,
- sin_family: sa_family_t,
- sin_port: in_port_t,
- sin_addr: in_addr,
- sin_zero: [u8, ..8],
+ pub sin_len: u8,
+ pub sin_family: sa_family_t,
+ pub sin_port: in_port_t,
+ pub sin_addr: in_addr,
+ pub sin_zero: [u8, ..8],
}
pub struct in_addr {
- s_addr: in_addr_t,
+ pub s_addr: in_addr_t,
}
pub struct sockaddr_in6 {
- sin6_len: u8,
- sin6_family: sa_family_t,
- sin6_port: in_port_t,
- sin6_flowinfo: u32,
- sin6_addr: in6_addr,
- sin6_scope_id: u32,
+ pub sin6_len: u8,
+ pub sin6_family: sa_family_t,
+ pub sin6_port: in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: in6_addr,
+ pub sin6_scope_id: u32,
}
pub struct in6_addr {
- s6_addr: [u16, ..8]
+ pub s6_addr: [u16, ..8]
}
pub struct ip_mreq {
- imr_multiaddr: in_addr,
- imr_interface: in_addr,
+ pub imr_multiaddr: in_addr,
+ pub imr_interface: in_addr,
}
pub struct ip6_mreq {
- ipv6mr_multiaddr: in6_addr,
- ipv6mr_interface: c_uint,
+ pub ipv6mr_multiaddr: in6_addr,
+ pub ipv6mr_interface: c_uint,
}
pub struct addrinfo {
- ai_flags: c_int,
- ai_family: c_int,
- ai_socktype: c_int,
- ai_protocol: c_int,
- ai_addrlen: socklen_t,
- ai_canonname: *c_char,
- ai_addr: *sockaddr,
- ai_next: *addrinfo
+ pub ai_flags: c_int,
+ pub ai_family: c_int,
+ pub ai_socktype: c_int,
+ pub ai_protocol: c_int,
+ pub ai_addrlen: socklen_t,
+ pub ai_canonname: *c_char,
+ pub ai_addr: *sockaddr,
+ pub ai_next: *addrinfo,
}
pub struct sockaddr_un {
- sun_len: u8,
- sun_family: sa_family_t,
- sun_path: [c_char, ..104]
+ pub sun_len: u8,
+ pub sun_family: sa_family_t,
+ pub sun_path: [c_char, ..104]
}
}
}
pub type blkcnt_t = i64;
pub type fflags_t = u32;
pub struct stat {
- st_dev: dev_t,
- st_ino: ino_t,
- st_mode: mode_t,
- st_nlink: nlink_t,
- st_uid: uid_t,
- st_gid: gid_t,
- st_rdev: dev_t,
- st_atime: time_t,
- st_atime_nsec: c_long,
- st_mtime: time_t,
- st_mtime_nsec: c_long,
- st_ctime: time_t,
- st_ctime_nsec: c_long,
- st_size: off_t,
- st_blocks: blkcnt_t,
- st_blksize: blksize_t,
- st_flags: fflags_t,
- st_gen: uint32_t,
- st_lspare: int32_t,
- st_birthtime: time_t,
- st_birthtime_nsec: c_long,
- __unused: [uint8_t, ..2],
+ pub st_dev: dev_t,
+ pub st_ino: ino_t,
+ pub st_mode: mode_t,
+ pub st_nlink: nlink_t,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub st_rdev: dev_t,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub st_size: off_t,
+ pub st_blocks: blkcnt_t,
+ pub st_blksize: blksize_t,
+ pub st_flags: fflags_t,
+ pub st_gen: uint32_t,
+ pub st_lspare: int32_t,
+ pub st_birthtime: time_t,
+ pub st_birthtime_nsec: c_long,
+ pub __unused: [uint8_t, ..2],
}
pub struct utimbuf {
- actime: time_t,
- modtime: time_t,
+ pub actime: time_t,
+ pub modtime: time_t,
}
pub type pthread_attr_t = *c_void;
use libc::types::os::arch::posix88::{dev_t, ino_t};
use libc::types::os::arch::posix88::mode_t;
- // Note: this is the struct called stat64 in win32. Not stat,
+ // pub Note: this is the struct called stat64 in win32. Not stat,
// nor stati64.
pub struct stat {
- st_dev: dev_t,
- st_ino: ino_t,
- st_mode: mode_t,
- st_nlink: c_short,
- st_uid: c_short,
- st_gid: c_short,
- st_rdev: dev_t,
- st_size: int64,
- st_atime: time64_t,
- st_mtime: time64_t,
- st_ctime: time64_t,
+ pub st_dev: dev_t,
+ pub st_ino: ino_t,
+ pub st_mode: mode_t,
+ pub st_nlink: c_short,
+ pub st_uid: c_short,
+ pub st_gid: c_short,
+ pub st_rdev: dev_t,
+ pub st_size: int64,
+ pub st_atime: time64_t,
+ pub st_mtime: time64_t,
+ pub st_ctime: time64_t,
}
// note that this is called utimbuf64 in win32
pub struct utimbuf {
- actime: time64_t,
- modtime: time64_t,
+ pub actime: time64_t,
+ pub modtime: time64_t,
}
pub struct timeval {
- tv_sec: time_t,
- tv_usec: suseconds_t,
+ pub tv_sec: time_t,
+ pub tv_usec: suseconds_t,
}
pub struct timespec {
- tv_sec: time_t,
- tv_nsec: c_long,
+ pub tv_sec: time_t,
+ pub tv_nsec: c_long,
}
pub enum timezone {}
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub struct sockaddr {
- sa_family: sa_family_t,
- sa_data: [u8, ..14],
+ pub sa_family: sa_family_t,
+ pub sa_data: [u8, ..14],
}
pub struct sockaddr_storage {
- ss_family: sa_family_t,
- __ss_align: i64,
- __ss_pad2: [u8, ..112],
+ pub ss_family: sa_family_t,
+ pub __ss_align: i64,
+ pub __ss_pad2: [u8, ..112],
}
pub struct sockaddr_in {
- sin_family: sa_family_t,
- sin_port: in_port_t,
- sin_addr: in_addr,
- sin_zero: [u8, ..8],
+ pub sin_family: sa_family_t,
+ pub sin_port: in_port_t,
+ pub sin_addr: in_addr,
+ pub sin_zero: [u8, ..8],
}
pub struct in_addr {
- s_addr: in_addr_t,
+ pub s_addr: in_addr_t,
}
pub struct sockaddr_in6 {
- sin6_family: sa_family_t,
- sin6_port: in_port_t,
- sin6_flowinfo: u32,
- sin6_addr: in6_addr,
- sin6_scope_id: u32,
+ pub sin6_family: sa_family_t,
+ pub sin6_port: in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: in6_addr,
+ pub sin6_scope_id: u32,
}
pub struct in6_addr {
- s6_addr: [u16, ..8]
+ pub s6_addr: [u16, ..8]
}
pub struct ip_mreq {
- imr_multiaddr: in_addr,
- imr_interface: in_addr,
+ pub imr_multiaddr: in_addr,
+ pub imr_interface: in_addr,
}
pub struct ip6_mreq {
- ipv6mr_multiaddr: in6_addr,
- ipv6mr_interface: c_uint,
+ pub ipv6mr_multiaddr: in6_addr,
+ pub ipv6mr_interface: c_uint,
}
pub struct addrinfo {
- ai_flags: c_int,
- ai_family: c_int,
- ai_socktype: c_int,
- ai_protocol: c_int,
- ai_addrlen: size_t,
- ai_canonname: *c_char,
- ai_addr: *sockaddr,
- ai_next: *addrinfo
+ pub ai_flags: c_int,
+ pub ai_family: c_int,
+ pub ai_socktype: c_int,
+ pub ai_protocol: c_int,
+ pub ai_addrlen: size_t,
+ pub ai_canonname: *c_char,
+ pub ai_addr: *sockaddr,
+ pub ai_next: *addrinfo,
}
pub struct sockaddr_un {
- sun_family: sa_family_t,
- sun_path: [c_char, ..108]
+ pub sun_family: sa_family_t,
+ pub sun_path: [c_char, ..108]
}
}
}
pub type int64 = i64;
pub struct STARTUPINFO {
- cb: DWORD,
- lpReserved: LPWSTR,
- lpDesktop: LPWSTR,
- lpTitle: LPWSTR,
- dwX: DWORD,
- dwY: DWORD,
- dwXSize: DWORD,
- dwYSize: DWORD,
- dwXCountChars: DWORD,
- dwYCountCharts: DWORD,
- dwFillAttribute: DWORD,
- dwFlags: DWORD,
- wShowWindow: WORD,
- cbReserved2: WORD,
- lpReserved2: LPBYTE,
- hStdInput: HANDLE,
- hStdOutput: HANDLE,
- hStdError: HANDLE
+ pub cb: DWORD,
+ pub lpReserved: LPWSTR,
+ pub lpDesktop: LPWSTR,
+ pub lpTitle: LPWSTR,
+ pub dwX: DWORD,
+ pub dwY: DWORD,
+ pub dwXSize: DWORD,
+ pub dwYSize: DWORD,
+ pub dwXCountChars: DWORD,
+ pub dwYCountCharts: DWORD,
+ pub dwFillAttribute: DWORD,
+ pub dwFlags: DWORD,
+ pub wShowWindow: WORD,
+ pub cbReserved2: WORD,
+ pub lpReserved2: LPBYTE,
+ pub hStdInput: HANDLE,
+ pub hStdOutput: HANDLE,
+ pub hStdError: HANDLE,
}
pub type LPSTARTUPINFO = *mut STARTUPINFO;
pub struct PROCESS_INFORMATION {
- hProcess: HANDLE,
- hThread: HANDLE,
- dwProcessId: DWORD,
- dwThreadId: DWORD
+ pub hProcess: HANDLE,
+ pub hThread: HANDLE,
+ pub dwProcessId: DWORD,
+ pub dwThreadId: DWORD,
}
pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
pub struct SYSTEM_INFO {
- wProcessorArchitecture: WORD,
- wReserved: WORD,
- dwPageSize: DWORD,
- lpMinimumApplicationAddress: LPVOID,
- lpMaximumApplicationAddress: LPVOID,
- dwActiveProcessorMask: DWORD,
- dwNumberOfProcessors: DWORD,
- dwProcessorType: DWORD,
- dwAllocationGranularity: DWORD,
- wProcessorLevel: WORD,
- wProcessorRevision: WORD
+ pub wProcessorArchitecture: WORD,
+ pub wReserved: WORD,
+ pub dwPageSize: DWORD,
+ pub lpMinimumApplicationAddress: LPVOID,
+ pub lpMaximumApplicationAddress: LPVOID,
+ pub dwActiveProcessorMask: DWORD,
+ pub dwNumberOfProcessors: DWORD,
+ pub dwProcessorType: DWORD,
+ pub dwAllocationGranularity: DWORD,
+ pub wProcessorLevel: WORD,
+ pub wProcessorRevision: WORD,
}
pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
}
pub struct MEMORY_BASIC_INFORMATION {
- BaseAddress: LPVOID,
- AllocationBase: LPVOID,
- AllocationProtect: DWORD,
- RegionSize: SIZE_T,
- State: DWORD,
- Protect: DWORD,
- Type: DWORD
+ pub BaseAddress: LPVOID,
+ pub AllocationBase: LPVOID,
+ pub AllocationProtect: DWORD,
+ pub RegionSize: SIZE_T,
+ pub State: DWORD,
+ pub Protect: DWORD,
+ pub Type: DWORD,
}
pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
pub struct OVERLAPPED {
- Internal: *c_ulong,
- InternalHigh: *c_ulong,
- Offset: DWORD,
- OffsetHigh: DWORD,
- hEvent: HANDLE,
+ pub Internal: *c_ulong,
+ pub InternalHigh: *c_ulong,
+ pub Offset: DWORD,
+ pub OffsetHigh: DWORD,
+ pub hEvent: HANDLE,
}
pub type LPOVERLAPPED = *mut OVERLAPPED;
pub struct FILETIME {
- dwLowDateTime: DWORD,
- dwHighDateTime: DWORD,
+ pub dwLowDateTime: DWORD,
+ pub dwHighDateTime: DWORD,
}
pub type LPFILETIME = *mut FILETIME;
pub struct GUID {
- Data1: DWORD,
- Data2: DWORD,
- Data3: DWORD,
- Data4: [BYTE, ..8],
+ pub Data1: DWORD,
+ pub Data2: DWORD,
+ pub Data3: DWORD,
+ pub Data4: [BYTE, ..8],
}
pub struct WSAPROTOCOLCHAIN {
- ChainLen: c_int,
- ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN],
+ pub ChainLen: c_int,
+ pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN],
}
pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
pub struct WSAPROTOCOL_INFO {
- dwServiceFlags1: DWORD,
- dwServiceFlags2: DWORD,
- dwServiceFlags3: DWORD,
- dwServiceFlags4: DWORD,
- dwProviderFlags: DWORD,
- ProviderId: GUID,
- dwCatalogEntryId: DWORD,
- ProtocolChain: WSAPROTOCOLCHAIN,
- iVersion: c_int,
- iAddressFamily: c_int,
- iMaxSockAddr: c_int,
- iMinSockAddr: c_int,
- iSocketType: c_int,
- iProtocol: c_int,
- iProtocolMaxOffset: c_int,
- iNetworkByteOrder: c_int,
- iSecurityScheme: c_int,
- dwMessageSize: DWORD,
- dwProviderReserved: DWORD,
- szProtocol: [u8, ..WSAPROTOCOL_LEN+1],
+ pub dwServiceFlags1: DWORD,
+ pub dwServiceFlags2: DWORD,
+ pub dwServiceFlags3: DWORD,
+ pub dwServiceFlags4: DWORD,
+ pub dwProviderFlags: DWORD,
+ pub ProviderId: GUID,
+ pub dwCatalogEntryId: DWORD,
+ pub ProtocolChain: WSAPROTOCOLCHAIN,
+ pub iVersion: c_int,
+ pub iAddressFamily: c_int,
+ pub iMaxSockAddr: c_int,
+ pub iMinSockAddr: c_int,
+ pub iSocketType: c_int,
+ pub iProtocol: c_int,
+ pub iProtocolMaxOffset: c_int,
+ pub iNetworkByteOrder: c_int,
+ pub iSecurityScheme: c_int,
+ pub dwMessageSize: DWORD,
+ pub dwProviderReserved: DWORD,
+ pub szProtocol: [u8, ..WSAPROTOCOL_LEN+1],
}
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
pub type pthread_t = uintptr_t;
pub struct glob_t {
- gl_pathc: size_t,
- __unused1: c_int,
- gl_offs: size_t,
- __unused2: c_int,
- gl_pathv: **c_char,
-
- __unused3: *c_void,
-
- __unused4: *c_void,
- __unused5: *c_void,
- __unused6: *c_void,
- __unused7: *c_void,
- __unused8: *c_void,
+ pub gl_pathc: size_t,
+ pub __unused1: c_int,
+ pub gl_offs: size_t,
+ pub __unused2: c_int,
+ pub gl_pathv: **c_char,
+
+ pub __unused3: *c_void,
+
+ pub __unused4: *c_void,
+ pub __unused5: *c_void,
+ pub __unused6: *c_void,
+ pub __unused7: *c_void,
+ pub __unused8: *c_void,
}
pub struct timeval {
- tv_sec: time_t,
- tv_usec: suseconds_t,
+ pub tv_sec: time_t,
+ pub tv_usec: suseconds_t,
}
pub struct timespec {
- tv_sec: time_t,
- tv_nsec: c_long,
+ pub tv_sec: time_t,
+ pub tv_nsec: c_long,
}
pub enum timezone {}
pub type in_port_t = u16;
pub type in_addr_t = u32;
pub struct sockaddr {
- sa_len: u8,
- sa_family: sa_family_t,
- sa_data: [u8, ..14],
+ pub sa_len: u8,
+ pub sa_family: sa_family_t,
+ pub sa_data: [u8, ..14],
}
pub struct sockaddr_storage {
- ss_len: u8,
- ss_family: sa_family_t,
- __ss_pad1: [u8, ..6],
- __ss_align: i64,
- __ss_pad2: [u8, ..112],
+ pub ss_len: u8,
+ pub ss_family: sa_family_t,
+ pub __ss_pad1: [u8, ..6],
+ pub __ss_align: i64,
+ pub __ss_pad2: [u8, ..112],
}
pub struct sockaddr_in {
- sin_len: u8,
- sin_family: sa_family_t,
- sin_port: in_port_t,
- sin_addr: in_addr,
- sin_zero: [u8, ..8],
+ pub sin_len: u8,
+ pub sin_family: sa_family_t,
+ pub sin_port: in_port_t,
+ pub sin_addr: in_addr,
+ pub sin_zero: [u8, ..8],
}
pub struct in_addr {
- s_addr: in_addr_t,
+ pub s_addr: in_addr_t,
}
pub struct sockaddr_in6 {
- sin6_len: u8,
- sin6_family: sa_family_t,
- sin6_port: in_port_t,
- sin6_flowinfo: u32,
- sin6_addr: in6_addr,
- sin6_scope_id: u32,
+ pub sin6_len: u8,
+ pub sin6_family: sa_family_t,
+ pub sin6_port: in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: in6_addr,
+ pub sin6_scope_id: u32,
}
pub struct in6_addr {
- s6_addr: [u16, ..8]
+ pub s6_addr: [u16, ..8]
}
pub struct ip_mreq {
- imr_multiaddr: in_addr,
- imr_interface: in_addr,
+ pub imr_multiaddr: in_addr,
+ pub imr_interface: in_addr,
}
pub struct ip6_mreq {
- ipv6mr_multiaddr: in6_addr,
- ipv6mr_interface: c_uint,
+ pub ipv6mr_multiaddr: in6_addr,
+ pub ipv6mr_interface: c_uint,
}
pub struct addrinfo {
- ai_flags: c_int,
- ai_family: c_int,
- ai_socktype: c_int,
- ai_protocol: c_int,
- ai_addrlen: socklen_t,
- ai_canonname: *c_char,
- ai_addr: *sockaddr,
- ai_next: *addrinfo
+ pub ai_flags: c_int,
+ pub ai_family: c_int,
+ pub ai_socktype: c_int,
+ pub ai_protocol: c_int,
+ pub ai_addrlen: socklen_t,
+ pub ai_canonname: *c_char,
+ pub ai_addr: *sockaddr,
+ pub ai_next: *addrinfo,
}
pub struct sockaddr_un {
- sun_len: u8,
- sun_family: sa_family_t,
- sun_path: [c_char, ..104]
+ pub sun_len: u8,
+ pub sun_family: sa_family_t,
+ pub sun_path: [c_char, ..104]
}
}
}
pub type blkcnt_t = i32;
pub struct stat {
- st_dev: dev_t,
- st_mode: mode_t,
- st_nlink: nlink_t,
- st_ino: ino_t,
- st_uid: uid_t,
- st_gid: gid_t,
- st_rdev: dev_t,
- st_atime: time_t,
- st_atime_nsec: c_long,
- st_mtime: time_t,
- st_mtime_nsec: c_long,
- st_ctime: time_t,
- st_ctime_nsec: c_long,
- st_birthtime: time_t,
- st_birthtime_nsec: c_long,
- st_size: off_t,
- st_blocks: blkcnt_t,
- st_blksize: blksize_t,
- st_flags: uint32_t,
- st_gen: uint32_t,
- st_lspare: int32_t,
- st_qspare: [int64_t, ..2],
+ pub st_dev: dev_t,
+ pub st_mode: mode_t,
+ pub st_nlink: nlink_t,
+ pub st_ino: ino_t,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub st_rdev: dev_t,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub st_birthtime: time_t,
+ pub st_birthtime_nsec: c_long,
+ pub st_size: off_t,
+ pub st_blocks: blkcnt_t,
+ pub st_blksize: blksize_t,
+ pub st_flags: uint32_t,
+ pub st_gen: uint32_t,
+ pub st_lspare: int32_t,
+ pub st_qspare: [int64_t, ..2],
}
pub struct utimbuf {
- actime: time_t,
- modtime: time_t,
+ pub actime: time_t,
+ pub modtime: time_t,
}
pub struct pthread_attr_t {
- __sig: c_long,
- __opaque: [c_char, ..36]
+ pub __sig: c_long,
+ pub __opaque: [c_char, ..36]
}
}
pub mod posix08 {
}
pub mod extra {
pub struct mach_timebase_info {
- numer: u32,
- denom: u32,
+ pub numer: u32,
+ pub denom: u32,
}
pub type mach_timebase_info_data_t = mach_timebase_info;
pub type blkcnt_t = i32;
pub struct stat {
- st_dev: dev_t,
- st_mode: mode_t,
- st_nlink: nlink_t,
- st_ino: ino_t,
- st_uid: uid_t,
- st_gid: gid_t,
- st_rdev: dev_t,
- st_atime: time_t,
- st_atime_nsec: c_long,
- st_mtime: time_t,
- st_mtime_nsec: c_long,
- st_ctime: time_t,
- st_ctime_nsec: c_long,
- st_birthtime: time_t,
- st_birthtime_nsec: c_long,
- st_size: off_t,
- st_blocks: blkcnt_t,
- st_blksize: blksize_t,
- st_flags: uint32_t,
- st_gen: uint32_t,
- st_lspare: int32_t,
- st_qspare: [int64_t, ..2],
+ pub st_dev: dev_t,
+ pub st_mode: mode_t,
+ pub st_nlink: nlink_t,
+ pub st_ino: ino_t,
+ pub st_uid: uid_t,
+ pub st_gid: gid_t,
+ pub st_rdev: dev_t,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub st_birthtime: time_t,
+ pub st_birthtime_nsec: c_long,
+ pub st_size: off_t,
+ pub st_blocks: blkcnt_t,
+ pub st_blksize: blksize_t,
+ pub st_flags: uint32_t,
+ pub st_gen: uint32_t,
+ pub st_lspare: int32_t,
+ pub st_qspare: [int64_t, ..2],
}
pub struct utimbuf {
- actime: time_t,
- modtime: time_t,
+ pub actime: time_t,
+ pub modtime: time_t,
}
pub struct pthread_attr_t {
- __sig: c_long,
- __opaque: [c_char, ..56]
+ pub __sig: c_long,
+ pub __opaque: [c_char, ..56]
}
}
pub mod posix08 {
}
pub mod extra {
pub struct mach_timebase_info {
- numer: u32,
- denom: u32,
+ pub numer: u32,
+ pub denom: u32,
}
pub type mach_timebase_info_data_t = mach_timebase_info;
/// methods on `Option`.
#[deriving(Clone)]
pub struct Item<A> {
- priv opt: Option<A>
+ opt: Option<A>
}
impl<A> Iterator<A> for Item<A> {
pub struct Pipe {
/// A file descriptor representing the reading end of the pipe. Data written
/// 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
/// 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.
/// let it leave scope by accident if you want it to stick around.
pub struct MemoryMap {
/// Pointer to the memory created or modified by this map.
- data: *mut u8,
+ pub data: *mut u8,
/// Number of bytes this map applies to
- len: uint,
+ pub len: uint,
/// Type of mapping
- kind: MemoryMapKind
+ pub kind: MemoryMapKind,
}
/// Type of memory map
/// Helper struct for printing paths with format!()
pub struct Display<'a, P> {
- priv path: &'a P,
- priv filename: bool
+ path: &'a P,
+ filename: bool
}
impl<'a, P: GenericPath> fmt::Show for Display<'a, P> {
/// Represents a POSIX file path
#[deriving(Clone)]
pub struct Path {
- priv repr: ~[u8], // assumed to never be empty or contain NULs
- priv sepidx: Option<uint> // index of the final separator in repr
+ repr: ~[u8], // assumed to never be empty or contain NULs
+ sepidx: Option<uint> // index of the final separator in repr
}
/// The standard path separator character
// preserved by the data structure; let the Windows API error out on them.
#[deriving(Clone)]
pub struct Path {
- priv repr: ~str, // assumed to never be empty
- priv prefix: Option<PathPrefix>,
- priv sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr
+ repr: ~str, // assumed to never be empty
+ prefix: Option<PathPrefix>,
+ sepidx: Option<uint> // index of the final separator in the non-prefix portion of repr
}
impl Eq for Path {
/// The representation of a Rust managed box
pub struct Box<T> {
- ref_count: uint,
- drop_glue: fn(ptr: *mut u8),
- prev: *mut Box<T>,
- next: *mut Box<T>,
- data: T
+ pub ref_count: uint,
+ pub drop_glue: fn(ptr: *mut u8),
+ pub prev: *mut Box<T>,
+ pub next: *mut Box<T>,
+ pub data: T,
}
/// The representation of a Rust vector
pub struct Vec<T> {
- fill: uint,
- alloc: uint,
- data: T
+ pub fill: uint,
+ pub alloc: uint,
+ pub data: T,
}
/// The representation of a Rust string
/// The representation of a Rust slice
pub struct Slice<T> {
- data: *T,
- len: uint
+ pub data: *T,
+ pub len: uint,
}
/// The representation of a Rust closure
pub struct Closure {
- code: *(),
- env: *(),
+ pub code: *(),
+ pub env: *(),
}
/// The representation of a Rust procedure (`proc()`)
pub struct Procedure {
- code: *(),
- env: *(),
+ pub code: *(),
+ pub env: *(),
}
/// The representation of a Rust trait object.
/// This struct does not have a `Repr` implementation
/// because there is no way to refer to all trait objects generically.
pub struct TraitObject {
- vtable: *(),
- data: *(),
+ pub vtable: *(),
+ pub data: *(),
}
/// This trait is meant to map equivalences between raw structs and their
/// Immutable reference counted pointer type
#[unsafe_no_drop_flag]
pub struct Rc<T> {
- priv ptr: *mut RcBox<T>,
- priv nosend: marker::NoSend,
- priv noshare: marker::NoShare
+ ptr: *mut RcBox<T>,
+ nosend: marker::NoSend,
+ noshare: marker::NoShare
}
impl<T> Rc<T> {
/// Weak reference to a reference-counted box
#[unsafe_no_drop_flag]
pub struct Weak<T> {
- priv ptr: *mut RcBox<T>,
- priv nosend: marker::NoSend,
- priv noshare: marker::NoShare
+ ptr: *mut RcBox<T>,
+ nosend: marker::NoSend,
+ noshare: marker::NoShare
}
impl<T> Weak<T> {
/// Adaptor to wrap around visitors implementing MovePtr.
pub struct MovePtrAdaptor<V> {
- priv inner: V
+ inner: V
}
pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
MovePtrAdaptor { inner: v }
}
pub struct ReprVisitor<'a> {
- priv ptr: *u8,
- priv ptr_stk: ~[*u8],
- priv var_stk: ~[VariantState],
- priv writer: &'a mut io::Writer,
- priv last_err: Option<io::IoError>,
+ ptr: *u8,
+ ptr_stk: ~[*u8],
+ var_stk: ~[VariantState],
+ writer: &'a mut io::Writer,
+ last_err: Option<io::IoError>,
}
pub fn ReprVisitor<'a>(ptr: *u8,
#[cfg(not(target_arch = "arm"))]
#[repr(C)]
-pub enum _Unwind_Action
-{
+pub enum _Unwind_Action {
_UA_SEARCH_PHASE = 1,
_UA_CLEANUP_PHASE = 2,
_UA_HANDLER_FRAME = 4,
#[cfg(target_arch = "arm")]
#[repr(C)]
-pub enum _Unwind_State
-{
- _US_VIRTUAL_UNWIND_FRAME = 0,
- _US_UNWIND_FRAME_STARTING = 1,
- _US_UNWIND_FRAME_RESUME = 2,
- _US_ACTION_MASK = 3,
- _US_FORCE_UNWIND = 8,
- _US_END_OF_STACK = 16
+pub enum _Unwind_State {
+ _US_VIRTUAL_UNWIND_FRAME = 0,
+ _US_UNWIND_FRAME_STARTING = 1,
+ _US_UNWIND_FRAME_RESUME = 2,
+ _US_ACTION_MASK = 3,
+ _US_FORCE_UNWIND = 8,
+ _US_END_OF_STACK = 16
}
#[repr(C)]
pub static unwinder_private_data_size: int = 2;
pub struct _Unwind_Exception {
- exception_class: _Unwind_Exception_Class,
- exception_cleanup: _Unwind_Exception_Cleanup_Fn,
- private: [_Unwind_Word, ..unwinder_private_data_size],
+ pub exception_class: _Unwind_Exception_Class,
+ pub exception_cleanup: _Unwind_Exception_Cleanup_Fn,
+ pub private: [_Unwind_Word, ..unwinder_private_data_size],
}
pub enum _Unwind_Context {}
pub type Box = raw::Box<()>;
pub struct MemoryRegion {
- priv allocations: Vec<*AllocHeader>,
- priv live_allocations: uint,
+ allocations: Vec<*AllocHeader>,
+ live_allocations: uint,
}
pub struct LocalHeap {
- priv memory_region: MemoryRegion,
+ memory_region: MemoryRegion,
- priv live_allocs: *mut raw::Box<()>,
+ live_allocs: *mut raw::Box<()>,
}
impl LocalHeap {
/// Encapsulates a borrowed value. When this value goes out of scope, the
/// pointer is returned.
pub struct Borrowed<T> {
- priv val: *(),
+ val: *(),
}
#[unsafe_destructor]
/// libuv (it does translation to windows under the hood).
pub struct FileOpenConfig {
/// Path to file to be opened
- path: Path,
+ pub path: Path,
/// 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
- priv mode: int
+ pub mode: int
}
/// Description of what to do when a file handle is closed
}
pub struct LocalIo<'a> {
- priv factory: &'a mut IoFactory,
+ factory: &'a mut IoFactory,
}
#[unsafe_destructor]
/// in the struct. This contains a pointer to another struct that holds
/// the type-specific state.
pub struct Task {
- heap: LocalHeap,
- gc: GarbageCollector,
- storage: LocalStorage,
- unwinder: Unwinder,
- death: Death,
- destroyed: bool,
- name: Option<SendStr>,
-
- stdout: Option<~Writer:Send>,
- stderr: Option<~Writer:Send>,
-
- priv imp: Option<~Runtime:Send>,
+ pub heap: LocalHeap,
+ pub gc: GarbageCollector,
+ pub storage: LocalStorage,
+ pub unwinder: Unwinder,
+ pub death: Death,
+ pub destroyed: bool,
+ pub name: Option<SendStr>,
+
+ pub stdout: Option<~Writer:Send>,
+ pub stderr: Option<~Writer:Send>,
+
+ imp: Option<~Runtime:Send>,
}
pub struct GarbageCollector;
/// Per-task state related to task death, killing, failure, etc.
pub struct Death {
- on_exit: Option<DeathAction>,
+ pub on_exit: Option<DeathAction>,
}
pub struct BlockedTasks {
- priv inner: UnsafeArc<AtomicUint>,
+ inner: UnsafeArc<AtomicUint>,
}
impl Task {
/// This struct represents a native thread's state. This is used to join on an
/// existing thread created in the join-able state.
pub struct Thread<T> {
- priv native: imp::rust_thread,
- priv joined: bool,
- priv packet: ~Option<T>,
+ native: imp::rust_thread,
+ joined: bool,
+ packet: ~Option<T>,
}
static DEFAULT_STACK_SIZE: uint = 1024 * 1024;
use uw = rt::libunwind;
pub struct Unwinder {
- priv unwinding: bool,
- priv cause: Option<~Any:Send>
+ unwinding: bool,
+ cause: Option<~Any:Send>
}
impl Unwinder {
/// An iterator over the slices of a vector separated by elements that
/// match a predicate function.
pub struct Splits<'a, T> {
- priv v: &'a [T],
- priv n: uint,
- priv pred: 'a |t: &T| -> bool,
- priv finished: bool
+ v: &'a [T],
+ n: uint,
+ pred: 'a |t: &T| -> bool,
+ finished: bool
}
impl<'a, T> Iterator<&'a [T]> for Splits<'a, T> {
/// An iterator over the slices of a vector separated by elements that
/// match a predicate function, from back to front.
pub struct RevSplits<'a, T> {
- priv v: &'a [T],
- priv n: uint,
- priv pred: 'a |t: &T| -> bool,
- priv finished: bool
+ v: &'a [T],
+ n: uint,
+ pred: 'a |t: &T| -> bool,
+ finished: bool
}
impl<'a, T> Iterator<&'a [T]> for RevSplits<'a, T> {
/// The last generated swap is always (0, 1), and it returns the
/// sequence to its initial order.
pub struct ElementSwaps {
- priv sdir: ~[SizeDirection],
+ sdir: ~[SizeDirection],
/// If true, emit the last swap that returns the sequence to initial state
- priv emit_reset: bool,
+ emit_reset: bool,
}
impl ElementSwaps {
///
/// Generates even and odd permutations alternately.
pub struct Permutations<T> {
- priv swaps: ElementSwaps,
- priv v: ~[T],
+ swaps: ElementSwaps,
+ v: ~[T],
}
impl<T: Clone> Iterator<~[T]> for Permutations<T> {
/// a vector.
#[deriving(Clone)]
pub struct Windows<'a, T> {
- priv v: &'a [T],
- priv size: uint
+ v: &'a [T],
+ size: uint
}
impl<'a, T> Iterator<&'a [T]> for Windows<'a, T> {
/// the last slice of the iteration will be the remainder.
#[deriving(Clone)]
pub struct Chunks<'a, T> {
- priv v: &'a [T],
- priv size: uint
+ v: &'a [T],
+ size: uint
}
impl<'a, T> Iterator<&'a [T]> for Chunks<'a, T> {
/// Immutable slice iterator
pub struct Items<'a, T> {
- priv ptr: *T,
- priv end: *T,
- priv marker: marker::ContravariantLifetime<'a>
+ ptr: *T,
+ end: *T,
+ marker: marker::ContravariantLifetime<'a>
}
/// Mutable slice iterator
pub struct MutItems<'a, T> {
- priv ptr: *mut T,
- priv end: *mut T,
- priv marker: marker::ContravariantLifetime<'a>,
- priv marker2: marker::NoCopy
+ ptr: *mut T,
+ end: *mut T,
+ marker: marker::ContravariantLifetime<'a>,
+ marker2: marker::NoCopy
}
macro_rules! iterator {
/// An iterator over the subslices of the vector which are separated
/// by elements that match `pred`.
pub struct MutSplits<'a, T> {
- priv v: &'a mut [T],
- priv pred: 'a |t: &T| -> bool,
- priv finished: bool
+ v: &'a mut [T],
+ pred: 'a |t: &T| -> bool,
+ finished: bool
}
impl<'a, T> Iterator<&'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 remainder.
pub struct MutChunks<'a, T> {
- priv v: &'a mut [T],
- priv chunk_size: uint
+ v: &'a mut [T],
+ chunk_size: uint
}
impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> {
/// An iterator that moves out of a vector.
pub struct MoveItems<T> {
- priv allocation: *mut u8, // the block of memory allocated for the vector
- priv iter: Items<'static, T>
+ allocation: *mut u8, // the block of memory allocated for the vector
+ iter: Items<'static, T>
}
impl<T> Iterator<T> for MoveItems<T> {
#[deriving(Clone)]
pub struct Chars<'a> {
/// The slice remaining to be iterated
- priv string: &'a str,
+ string: &'a str,
}
impl<'a> Iterator<char> for Chars<'a> {
#[deriving(Clone)]
pub struct CharOffsets<'a> {
/// The original string to be iterated
- priv string: &'a str,
- priv iter: Chars<'a>,
+ string: &'a str,
+ iter: Chars<'a>,
}
impl<'a> Iterator<(uint, char)> for CharOffsets<'a> {
#[deriving(Clone)]
pub struct CharSplits<'a, Sep> {
/// The slice remaining to be iterated
- priv string: &'a str,
- priv sep: Sep,
+ string: &'a str,
+ sep: Sep,
/// Whether an empty string at the end is allowed
- priv allow_trailing_empty: bool,
- priv only_ascii: bool,
- priv finished: bool,
+ allow_trailing_empty: bool,
+ only_ascii: bool,
+ finished: bool,
}
/// An iterator over the substrings of a string, separated by `sep`,
/// splitting at most `count` times.
#[deriving(Clone)]
pub struct CharSplitsN<'a, Sep> {
- priv iter: CharSplits<'a, Sep>,
+ iter: CharSplits<'a, Sep>,
/// The number of splits remaining
- priv count: uint,
- priv invert: bool,
+ count: uint,
+ invert: bool,
}
/// An iterator over the words of a string, separated by a sequence of whitespace
/// substring within a larger string
#[deriving(Clone)]
pub struct MatchIndices<'a> {
- priv haystack: &'a str,
- priv needle: &'a str,
- priv position: uint,
+ haystack: &'a str,
+ needle: &'a str,
+ position: uint,
}
/// An iterator over the substrings of a string separated by a given
/// search string
#[deriving(Clone)]
pub struct StrSplits<'a> {
- priv it: MatchIndices<'a>,
- priv last_end: uint,
- priv finished: bool
+ it: MatchIndices<'a>,
+ last_end: uint,
+ finished: bool
}
impl<'a> Iterator<(uint, uint)> for MatchIndices<'a> {
/// Use with the `std::iter` module.
#[deriving(Clone)]
pub struct Normalizations<'a> {
- priv kind: NormalizationForm,
- priv iter: Chars<'a>,
- priv buffer: ~[(char, u8)],
- priv sorted: bool
+ kind: NormalizationForm,
+ iter: Chars<'a>,
+ buffer: ~[(char, u8)],
+ sorted: bool
}
impl<'a> Iterator<char> for Normalizations<'a> {
/// of `u16`s.
#[deriving(Clone)]
pub struct UTF16Items<'a> {
- priv iter: slice::Items<'a, u16>
+ iter: slice::Items<'a, u16>
}
/// The possibilities for values decoded from a `u16` stream.
#[deriving(Eq, TotalEq, Clone, Show)]
/// for iterating over the UTF-8 bytes of a string.
pub struct CharRange {
/// Current `char`
- ch: char,
+ pub ch: char,
/// Index of the first byte of the next `char`
- next: uint
+ pub next: uint,
}
// Return the initial codepoint accumulator for the first byte.
/// Enforces no shared-memory safety.
#[unsafe_no_drop_flag]
pub struct UnsafeArc<T> {
- priv data: *mut ArcData<T>,
+ data: *mut ArcData<T>,
}
struct ArcData<T> {
/// An atomic boolean type.
pub struct AtomicBool {
- priv v: Unsafe<uint>,
- priv nocopy: marker::NoCopy
+ v: Unsafe<uint>,
+ nocopy: marker::NoCopy
}
/// A signed atomic integer type, supporting basic atomic arithmetic operations
pub struct AtomicInt {
- priv v: Unsafe<int>,
- priv nocopy: marker::NoCopy
+ v: Unsafe<int>,
+ nocopy: marker::NoCopy
}
/// An unsigned atomic integer type, supporting basic atomic arithmetic operations
pub struct AtomicUint {
- priv v: Unsafe<uint>,
- priv nocopy: marker::NoCopy
+ v: Unsafe<uint>,
+ nocopy: marker::NoCopy
}
/// An unsafe atomic pointer. Only supports basic atomic operations
pub struct AtomicPtr<T> {
- priv p: Unsafe<uint>,
- priv nocopy: marker::NoCopy
+ p: Unsafe<uint>,
+ nocopy: marker::NoCopy
}
/// An atomic, nullable unique pointer
/// owned heap objects across tasks.
#[unsafe_no_drop_flag]
pub struct AtomicOption<T> {
- priv p: Unsafe<uint>,
+ p: Unsafe<uint>,
}
/// Atomic memory orderings
///
/// There may only be one worker per deque.
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
/// opposite end of the deque from the worker, and they only have access to the
/// `steal` method.
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.
/// will only use this structure when allocating a new buffer or deallocating a
/// previous one.
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
}
pub struct Queue<T> {
- priv state: UnsafeArc<State<T>>,
+ state: UnsafeArc<State<T>>,
}
impl<T: Send> State<T> {
/// may be safely shared so long as it is guaranteed that there is only one
/// popper at a time (many pushers are allowed).
pub struct Queue<T> {
- priv head: AtomicPtr<Node<T>>,
- priv tail: *mut Node<T>,
+ head: AtomicPtr<Node<T>>,
+ tail: *mut Node<T>,
}
impl<T> Node<T> {
/// time.
pub struct Queue<T> {
// consumer fields
- priv tail: *mut Node<T>, // where to pop from
- priv tail_prev: AtomicPtr<Node<T>>, // where to pop from
+ tail: *mut Node<T>, // where to pop from
+ tail_prev: AtomicPtr<Node<T>>, // where to pop from
// producer fields
- priv head: *mut Node<T>, // where to push to
- priv first: *mut Node<T>, // where to get new nodes from
- priv tail_copy: *mut Node<T>, // between first/tail
+ head: *mut Node<T>, // where to push to
+ first: *mut Node<T>, // where to get new nodes from
+ tail_copy: *mut Node<T>, // between first/tail
// Cache maintenance fields. Additions and subtractions are stored
// separately in order to allow them to use nonatomic addition/subtraction.
- priv cache_bound: uint,
- priv cache_additions: AtomicUint,
- priv cache_subtractions: AtomicUint,
+ cache_bound: uint,
+ cache_additions: AtomicUint,
+ cache_subtractions: AtomicUint,
}
impl<T: Send> Node<T> {
/// Task configuration options
pub struct TaskOpts {
/// 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
- name: Option<SendStr>,
+ pub name: Option<SendStr>,
/// The size of the stack for the spawned task
- stack_size: Option<uint>,
+ pub stack_size: Option<uint>,
/// Task-local stdout
- stdout: Option<~Writer:Send>,
+ pub stdout: Option<~Writer:Send>,
/// Task-local stderr
- stderr: Option<~Writer:Send>,
+ pub stderr: Option<~Writer:Send>,
}
/**
// the run function move them in.
pub struct TaskBuilder {
/// Options to spawn the new task with
- opts: TaskOpts,
- priv gen_body: Option<proc:Send(v: proc:Send()) -> proc:Send()>,
- priv nocopy: Option<marker::NoCopy>,
+ pub opts: TaskOpts,
+ gen_body: Option<proc:Send(v: proc:Send()) -> proc:Send()>,
+ nocopy: Option<marker::NoCopy>,
}
/**
#[lang="unsafe"]
pub struct Unsafe<T> {
/// Wrapped value
- value: T,
+ pub value: T,
/// Invariance marker
- marker1: marker::InvariantType<T>
+ pub marker1: marker::InvariantType<T>
}
impl<T> Unsafe<T> {
use option::*;
use result::*;
-pub struct DynamicLibrary { priv handle: *u8}
+pub struct DynamicLibrary { handle: *u8}
impl Drop for DynamicLibrary {
fn drop(&mut self) {
/// Prefer the `NativeMutex` type where possible, since that does not
/// require manual deallocation.
pub struct StaticNativeMutex {
- priv inner: imp::Mutex,
+ inner: imp::Mutex,
}
/// A native mutex with a destructor for clean-up.
/// See `StaticNativeMutex` for a version that is suitable for storing in
/// statics.
pub struct NativeMutex {
- priv inner: StaticNativeMutex
+ inner: StaticNativeMutex
}
/// Automatically unlocks the mutex that it was created from on
/// then.
#[must_use]
pub struct LockGuard<'a> {
- priv lock: &'a StaticNativeMutex
+ lock: &'a StaticNativeMutex
}
pub static NATIVE_MUTEX_INIT: StaticNativeMutex = StaticNativeMutex {
}
pub struct Mutex {
- priv lock: Unsafe<pthread_mutex_t>,
- priv cond: Unsafe<pthread_cond_t>,
+ lock: Unsafe<pthread_mutex_t>,
+ cond: Unsafe<pthread_cond_t>,
}
pub static MUTEX_INIT: Mutex = Mutex {
pub struct Mutex {
// pointers for the lock/cond handles, atomically updated
- priv lock: atomics::AtomicUint,
- priv cond: atomics::AtomicUint,
+ lock: atomics::AtomicUint,
+ cond: atomics::AtomicUint,
}
pub static MUTEX_INIT: Mutex = Mutex {
* need to block or deschedule while accessing shared state, use extra::sync::RWArc.
*/
pub struct Exclusive<T> {
- priv x: UnsafeArc<ExData<T>>
+ x: UnsafeArc<ExData<T>>
}
impl<T:Send> Clone for Exclusive<T> {
/// ```
#[unsafe_no_drop_flag]
pub struct Vec<T> {
- priv len: uint,
- priv cap: uint,
- priv ptr: *mut T
+ len: uint,
+ cap: uint,
+ ptr: *mut T
}
impl<T> Vec<T> {
/// An iterator that moves out of a vector.
pub struct MoveItems<T> {
- priv allocation: *mut c_void, // the block of memory allocated for the vector
- priv iter: Items<'static, T>
+ allocation: *mut c_void, // the block of memory allocated for the vector
+ iter: Items<'static, T>
}
impl<T> Iterator<T> for MoveItems<T> {