1
Fork 0

Refined the example

This commit is contained in:
MagnumOpus21 2018-08-12 20:49:34 -04:00 committed by Siva Prasad
parent 2ae2c628ee
commit 3ae6d06edb

View file

@ -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 {