about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMagnumOpus21 <sivaauturic@gmail.com>2018-08-12 20:49:34 -0400
committerSiva Prasad <sivauturic@gmail.com>2018-09-05 08:56:00 -0400
commit3ae6d06edbf57ce61a1f41e297dba750baf15ecb (patch)
treebdc77b664a8a7a5ab269007ad738706375b517bf
parent2ae2c628eec74b78d691c2df7a1eccbe9cbd0a72 (diff)
downloadrust-3ae6d06edbf57ce61a1f41e297dba750baf15ecb.tar.gz
rust-3ae6d06edbf57ce61a1f41e297dba750baf15ecb.zip
Refined the example
-rw-r--r--src/libcore/macros.rs32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 4bf5a6302bc..2929fc9057d 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -349,34 +349,22 @@ macro_rules! try {
 /// write!(&mut v, "s = {:?}", s).unwrap(); // uses io::Write::write_fmt
 /// assert_eq!(v, b"s = \"abc 123\"");
 /// ```
-
-/// /// Note : This macro can be used in no_std setups as well
-/// /// In a no_std setup you are responsible for the 
-/// /// implementation details of the components.
-
-/// ```rust
-///  extern crate core;
+/// Note : This macro can be used in no_std setups as well
+/// In a no_std setup you are responsible for the 
+/// implementation details of the components.
+/// ```
+///  # extern crate core;
 ///  use core::fmt::Write;
-
-///  #[derive(Debug)]
-///  struct Greetings<'a>{
-///      message : &'a str,
+///  struct Example{
 ///  }
-
-
-///  impl<'a> Write for Greetings<'a>{
+///  impl Write for Example{
 ///      fn write_str(&mut self, _s: &str) -> core::fmt::Result {
 ///           unimplemented!();
 ///      }
 ///  }
-
-///  fn main(){
-///      let mut m = Greetings{message: ""};
-///      write!(&mut m, "Hello World").expect("Not written");
-///  }
+///  let mut m = Example{};
+///  write!(&mut m, "Hello World").expect("Not written");
 /// ```
-
-
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 macro_rules! write {
@@ -746,4 +734,4 @@ mod builtin {
         ($cond:expr,) => ({ /* compiler built-in */ });
         ($cond:expr, $($arg:tt)+) => ({ /* compiler built-in */ });
     }
-}
+}
\ No newline at end of file