io::write! [] [src]

macro_rules! write {
    ($text: expr) => ({
        let mut result: bool = false;

        for len in 0i32..std::i32::MAX {
            if unsafe {
                *$text.offset(len as isize)
            } == 0u8 {
                result = write!($text, len);
                break ;
            }
        }
        result
    });
    ($text: expr, $len: expr) => ({
        write!($text, $len, 1)
    });
    ($text: expr, $len: expr, $out: expr) => ({
        extern crate io;
        match unsafe {
            io::ffi::write (
                $out as i32,
                $text as *const i8,
                $len as i32,
            )
        } {
          -1 => false,
          _ => true,
        }
    });
}

The write macro writes to output the text and returns the Some 0i32 or None according to success.