Document some trait methods.

This commit is contained in:
Jonas Hietala
2014-07-19 12:10:09 +02:00
parent ef352faea8
commit 41729b83bc
3 changed files with 203 additions and 6 deletions

View File

@@ -13,6 +13,16 @@
/// A trait that types which have a useful default value should implement.
pub trait Default {
/// Return the "default value" for a type.
///
/// # Example
///
/// ```
/// use std::default::Default;
///
/// let i: i8 = Default::default();
/// let (x, y): (Option<String>, f64) = Default::default();
/// let (a, b, (c, d)): (int, uint, (bool, bool)) = Default::default();
/// ```
fn default() -> Self;
}