Skip to content

Commit

Permalink
Auto merge of rust-lang#41179 - mandeep:add-fmtresult-example, r=frew…
Browse files Browse the repository at this point in the history
…sxcv

Added doc comments for fmt::Result

Added doc comments for fmt::Result in regards to item 3 in issue rust-lang#29355. I'm not certain that this is all that's needed but I think it's a good starting point on this item.
  • Loading branch information
bors committed Apr 10, 2017
2 parents 2bdf368 + 1e7f355 commit 8493dd6
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,31 @@ pub mod rt {
pub mod v1;
}

#[stable(feature = "rust1", since = "1.0.0")]
/// The type returned by formatter methods.
///
/// # Examples
///
/// ```
/// use std::fmt;
///
/// #[derive(Debug)]
/// struct Triangle {
/// a: f32,
/// b: f32,
/// c: f32
/// }
///
/// impl fmt::Display for Triangle {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// write!(f, "({}, {}, {})", self.a, self.b, self.c)
/// }
/// }
///
/// let pythagorean_triple = Triangle { a: 3.0, b: 4.0, c: 5.0 };
///
/// println!("{}", pythagorean_triple);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub type Result = result::Result<(), Error>;

/// The error type which is returned from formatting a message into a stream.
Expand Down

0 comments on commit 8493dd6

Please sign in to comment.