]> git.lizzy.rs Git - rust.git/commitdiff
libextra: Require documentation by default
authorAlex Crichton <alex@alexcrichton.com>
Wed, 29 May 2013 03:11:41 +0000 (22:11 -0500)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 30 May 2013 06:03:15 +0000 (01:03 -0500)
41 files changed:
src/libextra/arc.rs
src/libextra/arena.rs
src/libextra/base64.rs
src/libextra/bitv.rs
src/libextra/dbg.rs
src/libextra/deque.rs
src/libextra/dlist.rs
src/libextra/ebml.rs
src/libextra/fileinput.rs
src/libextra/flate.rs
src/libextra/flatpipes.rs
src/libextra/future.rs
src/libextra/getopts.rs
src/libextra/io_util.rs
src/libextra/json.rs
src/libextra/md4.rs
src/libextra/net_ip.rs
src/libextra/net_tcp.rs
src/libextra/net_url.rs
src/libextra/num/bigint.rs
src/libextra/num/complex.rs
src/libextra/num/rational.rs
src/libextra/priority_queue.rs
src/libextra/rc.rs
src/libextra/rope.rs
src/libextra/semver.rs
src/libextra/serialize.rs
src/libextra/smallintmap.rs
src/libextra/sort.rs
src/libextra/stats.rs
src/libextra/std.rc
src/libextra/task_pool.rs
src/libextra/tempfile.rs
src/libextra/term.rs
src/libextra/time.rs
src/libextra/treemap.rs
src/libextra/unicode.rs
src/libextra/uv_iotask.rs
src/libextra/uv_ll.rs
src/libextra/workcache.rs
src/libstd/run.rs

index e73b49044d42110ecf93601ecd5d3703f7f73091..1de2003aa99d592dda4aa143056a22367478601d 100644 (file)
@@ -37,6 +37,8 @@
  * ~~~
  */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use sync;
index 690993e7bf9a213668dd126148063dcc3cba1e72..7cd63cd03b1aaa7efb7677b33c2e2be06649cc84 100644 (file)
@@ -32,6 +32,8 @@
 // overhead when initializing plain-old-data and means we don't need
 // to waste time running the destructors of POD.
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use list::{MutList, MutCons, MutNil};
index 373bebeec71ce0ae70d0c924ff6d80516ff126d6..b8f3a267d2d24ce8f983783b5a20c9b860769db0 100644 (file)
 use core::str;
 use core::vec;
 
+/// A trait for converting a value to base64 encoding.
 pub trait ToBase64 {
+    /// Converts the value of `self` to a base64 value, returning the owned
+    /// string
     fn to_base64(&self) -> ~str;
 }
 
@@ -112,6 +115,7 @@ fn to_base64(&self) -> ~str {
     }
 }
 
+#[allow(missing_doc)]
 pub trait FromBase64 {
     fn from_base64(&self) -> ~[u8];
 }
index afd82d425891b3b63dea6c301d4dbdeea751219a..672a61b1ad8dd715820f36b1b259a746b867ee2c 100644 (file)
@@ -211,9 +211,11 @@ enum BitvVariant { Big(~BigBitv), Small(~SmallBitv) }
 
 enum Op {Union, Intersect, Assign, Difference}
 
-// The bitvector type
+/// The bitvector type
 pub struct Bitv {
+    /// Internal representation of the bit vector (small or large)
     rep: BitvVariant,
+    /// The number of valid bits in the internal representation
     nbits: uint
 }
 
index 4b2d2a60a68ef5d275d2b1aa237fa4b081cce9a3..cbd7cb5e3c08f75709f45c0a63a7c8192ac13509 100644 (file)
@@ -10,6 +10,8 @@
 
 //! Unsafe debugging functions for inspecting values.
 
+#[allow(missing_doc)];
+
 use core::cast::transmute;
 use core::sys;
 
index ccb52fa038c1288839af1c7b09c45b417adea58f..08dc2436c9339a684cdf6a6fdc188d16eeffd4d1 100644 (file)
@@ -18,6 +18,7 @@
 
 static initial_capacity: uint = 32u; // 2^5
 
+#[allow(missing_doc)]
 pub struct Deque<T> {
     priv nelts: uint,
     priv lo: uint,
index fc6cdb102a0ef2bfacf9d327797a50a40c8cac0a..5581c6d5ac9d9bb92eefef0436bddf2240659f1f 100644 (file)
@@ -26,6 +26,7 @@
 
 pub type DListLink<T> = Option<@mut DListNode<T>>;
 
+#[allow(missing_doc)]
 pub struct DListNode<T> {
     data: T,
     linked: bool, // for assertions
@@ -33,6 +34,7 @@ pub struct DListNode<T> {
     next: DListLink<T>,
 }
 
+#[allow(missing_doc)]
 pub struct DList<T> {
     size: uint,
     hd: DListLink<T>,
@@ -106,6 +108,7 @@ pub fn from_elem<T>(data: T) -> @mut DList<T> {
     list
 }
 
+/// Creates a new dlist from a vector of elements, maintaining the same order
 pub fn from_vec<T:Copy>(vec: &[T]) -> @mut DList<T> {
     do vec::foldl(DList(), vec) |list,data| {
         list.push(*data); // Iterating left-to-right -- add newly to the tail.
index 762328a2e0f64aab37dbe6d9d7806f497dcf26b9..70beaa58d07b72da055860357caefb410aab08bc 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 // Simple Extensible Binary Markup Language (ebml) reader and writer on a
index e6f3fba6b157fcfb3a4749403b5a9469d0aa3abb..5cc0875cb51b5b3d9b56275da4a93893321fdac9 100644 (file)
@@ -94,6 +94,8 @@
     }
 */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::io::ReaderUtil;
index e24c80b4463c3dd085857757769c9525ac93ddd6..076126e04329caa326b4f2044bb182686e648932 100644 (file)
@@ -14,6 +14,8 @@
 
 */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::libc::{c_void, size_t, c_int};
index 955da13c7b38b867e01de44e0ccda467e6f24476..2f5a43d8e84dde674ec31de67b39ae376b23efa0 100644 (file)
@@ -47,6 +47,8 @@
 
 */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 // The basic send/recv interface FlatChan and PortChan will implement
index 38df0c6a2085cd47ebba5fa38dd57983625df0af..4d3a757e80ed4b926df6bf7b46682f10b6555ac3 100644 (file)
@@ -23,6 +23,8 @@
  * ~~~
  */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::cast;
index 3c223fe05d410560fffd6ac68885f34fcff4120e..294b8fec0423648685c8b6f7af91d5280c614891 100644 (file)
@@ -78,6 +78,8 @@
  * ```
  */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::cmp::Eq;
index 7d43663cc808b0db971d74a3eaa65e2e0e0b2d7d..91424ae3ba2c0d6a749352549c54717232d3a59c 100644 (file)
 use core::io::{Reader, BytesReader};
 use core::io;
 
+/// An implementation of the io::Reader interface which reads a buffer of bytes
 pub struct BufReader {
+    /// The buffer of bytes to read
     buf: ~[u8],
+    /// The current position in the buffer of bytes
     pos: @mut uint
 }
 
-pub impl BufReader {
+impl BufReader {
+    /// Creates a new buffer reader for the specified buffer
     pub fn new(v: ~[u8]) -> BufReader {
         BufReader {
             buf: v,
@@ -24,7 +28,7 @@ pub fn new(v: ~[u8]) -> BufReader {
         }
     }
 
-    priv fn as_bytes_reader<A>(&self, f: &fn(&BytesReader) -> A) -> A {
+    fn as_bytes_reader<A>(&self, f: &fn(&BytesReader) -> A) -> A {
         // Recreating the BytesReader state every call since
         // I can't get the borrowing to work correctly
         let bytes_reader = BytesReader {
index c3ef346dba3ba484c5ea2eab3e71cc88c2baffb8..48a3288f809036d7d8007d4ecc5bf684c29d9d86 100644 (file)
@@ -43,9 +43,14 @@ pub enum Json {
 pub type Object = HashMap<~str, Json>;
 
 #[deriving(Eq)]
+/// If an error occurs while parsing some JSON, this is the structure which is
+/// returned
 pub struct Error {
+    /// The line number at which the error occurred
     line: uint,
+    /// The column number at which the error occurred
     col: uint,
+    /// A message describing the type of the error
     msg: @~str,
 }
 
@@ -75,10 +80,13 @@ fn spaces(n: uint) -> ~str {
     return ss;
 }
 
+/// A structure for implementing serialization to JSON.
 pub struct Encoder {
     priv wr: @io::Writer,
 }
 
+/// Creates a new JSON encoder whose output will be written to the writer
+/// specified.
 pub fn Encoder(wr: @io::Writer) -> Encoder {
     Encoder {
         wr: wr
@@ -228,11 +236,14 @@ fn emit_map_elt_val(&mut self, _idx: uint, f: &fn(&mut Encoder)) {
     }
 }
 
+/// Another encoder for JSON, but prints out human-readable JSON instead of
+/// compact data
 pub struct PrettyEncoder {
     priv wr: @io::Writer,
     priv indent: uint,
 }
 
+/// Creates a new encoder whose output will be written to the specified writer
 pub fn PrettyEncoder(wr: @io::Writer) -> PrettyEncoder {
     PrettyEncoder {
         wr: wr,
@@ -468,6 +479,7 @@ pub fn to_pretty_str(json: &Json) -> ~str {
     io::with_str_writer(|wr| to_pretty_writer(wr, json))
 }
 
+#[allow(missing_doc)]
 pub struct Parser {
     priv rdr: @io::Reader,
     priv ch: char,
@@ -846,10 +858,12 @@ pub fn from_str(s: &str) -> Result<Json, Error> {
     }
 }
 
+/// A structure to decode JSON to values in rust.
 pub struct Decoder {
     priv stack: ~[Json],
 }
 
+/// Creates a new decoder instance for decoding the specified JSON value.
 pub fn Decoder(json: Json) -> Decoder {
     Decoder {
         stack: ~[json]
@@ -1200,7 +1214,11 @@ fn ge(&self, other: &Json) -> bool { !(*self).lt(other) }
     fn gt(&self, other: &Json) -> bool { (*other).lt(&(*self))  }
 }
 
-trait ToJson { fn to_json(&self) -> Json; }
+/// A trait for converting values to JSON
+trait ToJson {
+    /// Converts the value of `self` to an instance of JSON
+    fn to_json(&self) -> Json;
+}
 
 impl ToJson for Json {
     fn to_json(&self) -> Json { copy *self }
index 9873d7fcd8e3516c6e150f3448364dcd6d938a35..0f05e50ea7024709253374760302cc059c8fd975 100644 (file)
@@ -21,6 +21,8 @@ struct Quad {
     d: u32
 }
 
+/// Calculates the md4 hash of the given slice of bytes, returning the 128-bit
+/// result as a quad of u32's
 pub fn md4(msg: &[u8]) -> Quad {
     // subtle: if orig_len is merely uint, then the code below
     // which performs shifts by 32 bits or more has undefined
@@ -105,6 +107,8 @@ fn rot(r: int, x: u32) -> u32 {
     return Quad {a: a, b: b, c: c, d: d};
 }
 
+/// Calculates the md4 hash of a slice of bytes, returning the hex-encoded
+/// version of the hash
 pub fn md4_str(msg: &[u8]) -> ~str {
     let Quad {a, b, c, d} = md4(msg);
     fn app(a: u32, b: u32, c: u32, d: u32, f: &fn(u32)) {
@@ -123,6 +127,8 @@ fn app(a: u32, b: u32, c: u32, d: u32, f: &fn(u32)) {
     result
 }
 
+/// Calculates the md4 hash of a string, returning the hex-encoded version of
+/// the hash
 pub fn md4_text(msg: &str) -> ~str { md4_str(str::to_bytes(msg)) }
 
 #[test]
index a9c8540a83cc9b028a1a8539bea4e978cea4b3ce..e92523726dfaab9d4121ff5c275b4c713cbd8f88 100644 (file)
@@ -10,6 +10,8 @@
 
 //! Types/fns concerning Internet Protocol (IP), versions 4 & 6
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::libc;
index 8dff9b330a5b013cb21fe33e762cc9ddb4082a78..c3a0463c2fc8745ce6ff352a16e6d2845285035c 100644 (file)
@@ -11,6 +11,8 @@
 //! High-level interface to libuv's TCP functionality
 // FIXME #4425: Need FFI fixes
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use future;
index 3b7c808c596eadb43a5c50713024791543f548c0..fa7295923a0084f3890054d30af3d601cf5f214e 100644 (file)
@@ -10,6 +10,8 @@
 
 //! Types/fns concerning URLs (see RFC 3986)
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::cmp::Eq;
index 263618ed56f9b37c5278e72d7d848b35635bf626..adbaf89e16c470e76a0132aef49d985c7318a221 100644 (file)
@@ -597,6 +597,8 @@ pub fn parse_bytes(buf: &[u8], radix: uint)
     }
 
 
+    /// Converts this big integer into a uint, returning the uint::max_value if
+    /// it's too large to fit in a uint.
     pub fn to_uint(&self) -> uint {
         match self.data.len() {
             0 => 0,
index 09bd66232eb04a8fddd1a0268db169056ce2d815..10bfe9409daa4b07cde287ec72ae800561eb0653 100644 (file)
@@ -25,7 +25,9 @@
 /// A complex number in Cartesian form.
 #[deriving(Eq,Clone)]
 pub struct Cmplx<T> {
+    /// Real portion of the complex number
     re: T,
+    /// Imaginary portion of the complex number
     im: T
 }
 
index b33d113161c36cb5ca42cd208d7c2da954b26b85..1a8ab75b3dd0d7ad205220521cc74417bb6c6ba8 100644 (file)
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
 //! Rational numbers
 
 use core::prelude::*;
@@ -22,6 +21,7 @@
 
 /// Represents the ratio between 2 numbers.
 #[deriving(Clone)]
+#[allow(missing_doc)]
 pub struct Ratio<T> {
     numer: T,
     denom: T
@@ -49,7 +49,7 @@ pub fn new_raw(numer: T, denom: T) -> Ratio<T> {
         Ratio { numer: numer, denom: denom }
     }
 
-    // Create a new Ratio. Fails if `denom == 0`.
+    /// Create a new Ratio. Fails if `denom == 0`.
     #[inline(always)]
     pub fn new(numer: T, denom: T) -> Ratio<T> {
         if denom == Zero::zero() {
index 9345c24675091d02d559b381aaeba293fbbd2de2..49fbf06406f4e4175704125c3b8ae2a5ae57d68e 100644 (file)
@@ -17,6 +17,7 @@
 use core::util::{replace, swap};
 use core::vec;
 
+#[allow(missing_doc)]
 pub struct PriorityQueue<T> {
     priv data: ~[T],
 }
index 73f98a3b19c59e0c3ee0cd64434d356d6be243bb..381b8ac05ba3611752da152faba7cb5f1ae9eb57 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(missing_doc)];
+
 /** Task-local reference counted smart pointers
 
 Task-local reference counted smart pointers are an alternative to managed boxes with deterministic
index 566bbfd6df6a333e2189e6c2c4ef4e703e177772..413a498a20ec59e5f8595274fc780783a6a0bfd1 100644 (file)
@@ -33,6 +33,8 @@
  * * access to a character by index is logarithmic (linear in strings);
  */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::str;
index 0b07886772687f8ee24027c7a68cbdc73c8ac810..494f0c8ea815f03376e1a50894c8620488b0b46d 100644 (file)
@@ -10,6 +10,8 @@
 
 //! Semver parsing and logic
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::char;
index d20aed69240d2d82fbaf0f9a10e3b6e2e62507ec..4d2b8d0b50a282fff7bca88abc296e0bd466f9da 100644 (file)
@@ -14,6 +14,7 @@
 Core encoding and decoding interfaces.
 */
 
+#[allow(missing_doc)];
 #[forbid(non_camel_case_types)];
 
 use core::prelude::*;
index a85f113b68fb4dd1d4e867e881ba7826e29e1fb3..98392fc41e1bcf3ba7d03dfebebc88afe2dc76a9 100644 (file)
@@ -23,6 +23,7 @@
 use core::util::replace;
 use core::vec;
 
+#[allow(missing_doc)]
 pub struct SmallIntMap<T> {
     priv v: ~[Option<T>],
 }
@@ -186,6 +187,9 @@ fn update(&mut self, key: uint, newval: V, ff: &fn(V, V) -> V) -> bool {
     }
 }
 
+/// A set implemented on top of the SmallIntMap type. This set is always a set
+/// of integers, and the space requirements are on the order of the highest
+/// valued integer in the set.
 pub struct SmallIntSet {
     priv map: SmallIntMap<()>
 }
index b3118dd37e12ef90905ceb08030fc855f2e88afc..420c63efab5d3d7a1157a1ae4eedfa372a5779f1 100644 (file)
@@ -167,6 +167,7 @@ pub fn quick_sort3<T:Copy + Ord + Eq>(arr: &mut [T]) {
     qsort3(arr, 0, (len - 1) as int);
 }
 
+#[allow(missing_doc)]
 pub trait Sort {
     fn qsort(self);
 }
@@ -179,6 +180,7 @@ impl<'self, T:Copy + Ord + Eq> Sort for &'self mut [T] {
 static MIN_GALLOP: uint = 7;
 static INITIAL_TMP_STORAGE: uint = 128;
 
+#[allow(missing_doc)]
 pub fn tim_sort<T:Copy + Ord>(array: &mut [T]) {
     let size = array.len();
     if size < 2 {
index 504930a884ee1ca8b0e7ae7a83cdf2c46223f3f8..d224777ded702dfe3265f12445b6517d8eb4dcf0 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::vec;
index 8c03701f513104fc478f7ad88b7921cc81d5f2cc..a81ab3005f6d1b42b04346c2302bc22dc8d585fb 100644 (file)
@@ -27,8 +27,12 @@ not required in or otherwise suitable for the core library.
 #[crate_type = "lib"];
 
 #[deny(non_camel_case_types)];
+#[deny(missing_doc)];
+
+// NOTE: remove these two attributes after the next snapshot
+#[no_core]; // for stage0
+#[allow(unrecognized_lint)]; // otherwise stage0 is seriously ugly
 
-#[no_core];
 #[no_std];
 
 extern mod core(name = "std", vers = "0.7-pre");
index eba4f0d1b75c06f6236fee680b41353044db7598..06bc3167040d2fc45e16b651cd3aa92751df147d 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(missing_doc)];
+
 /// A task pool abstraction. Useful for achieving predictable CPU
 /// parallelism.
 
index c514631e787fb8c0f15e397a4e587fe6e89043a9..6d0bd8881950040cbe338b7758db7d862eb9e710 100644 (file)
@@ -16,6 +16,8 @@
 use core::rand::RngUtil;
 use core::rand;
 
+/// Attempts to make a temporary directory inside of `tmpdir` whose name will
+/// have the suffix `suffix`. If no directory can be created, None is returned.
 pub fn mkdtemp(tmpdir: &Path, suffix: &str) -> Option<Path> {
     let mut r = rand::rng();
     for 1000.times {
index 7dace57a1b52bd444680eb5f53bfceb4a63c0f00..a76852dc6615ab53d5facdec88617d5b693d7eb5 100644 (file)
@@ -10,6 +10,8 @@
 
 //! Simple ANSI color library
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::io;
index 93fbf6a405431496b3b1b314c87fb768349afbb7..8603d0f814a71fcd505a3712dbf3c92fa2e768cb 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use core::i32;
index a05c532c92f6e23175ef7e746bef3cf2d9cb2d9f..e6db84e855cf5cd83bf0065fc1f618e39c20e78f 100644 (file)
@@ -34,6 +34,7 @@
 //   * union: |
 // These would be convenient since the methods work like `each`
 
+#[allow(missing_doc)]
 pub struct TreeMap<K, V> {
     priv root: Option<~TreeNode<K, V>>,
     priv length: uint
@@ -242,6 +243,9 @@ fn next(&mut self) -> Option<&'self T> {
     }
 }
 
+/// A implementation of the `Set` trait on top of the `TreeMap` container. The
+/// only requirement is that the type of the elements contained ascribes to the
+/// `TotalOrd` trait.
 pub struct TreeSet<T> {
     priv map: TreeMap<T, ()>
 }
index 77996de6d8394a4995935926d72583fde32a2074..3bd05a4153447147637b190e734ce524f13e5c5b 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #[forbid(deprecated_mode)];
+#[allow(missing_doc)];
 
 pub mod icu {
     pub type UBool = u8;
index 6cf753b801620b9b56142fee569697c8db01af5d..817dfa28aeedfb5b8dd10f94b051c347889bdc08 100644 (file)
@@ -15,6 +15,8 @@
  * `interact` function you can execute code in a uv callback.
  */
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use ll = uv_ll;
index d5f7cb12e4f0bf3df37a261d38b60b16ad3e8df9..2cb2eea88283bcc77bcccba47a69b36d51a82ade 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 #[allow(non_camel_case_types)]; // C types
+#[allow(missing_doc)];
 
 use core::prelude::*;
 
index 798cf1ba55d6f8ee2e9040fd77eff614b2483b1d..19913fb92f47f1b5e77609f3dded05ea8705bbd7 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#[allow(missing_doc)];
+
 use core::prelude::*;
 
 use json;
index 7c73aca3af93270655855618c6f866612cb77971..de1148e431b8475b37d59ba3aed8c22b1849e702 100644 (file)
@@ -10,6 +10,8 @@
 
 //! Process spawning.
 
+#[allow(missing_doc)];
+
 use cast;
 use comm::{stream, SharedChan, GenericChan, GenericPort};
 use int;