]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/default.rs
auto merge of #15806 : treeman/rust/std-doc, r=alexcrichton
[rust.git] / src / libcore / default.rs
index 70780515dec9d943ed0f4358afc64049ad20ac1a..4de2384d23dc30b1f57ed2aea5b56ab98dc5d73b 100644 (file)
 /// 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;
 }