8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ use fmt;
11
12
use libc;
12
13
use option:: { Option , Some , None } ;
13
14
use result:: { Ok , Err } ;
@@ -56,7 +57,9 @@ pub fn stderr() -> StdWriter {
56
57
pub fn print ( s : & str ) {
57
58
// XXX: need to see if not caching stdin() is the cause of performance
58
59
// issues, it should be possible to cache a stdout handle in each Task
59
- // and then re-use that across calls to print/println
60
+ // and then re-use that across calls to print/println. Note that the
61
+ // resolution of this comment will affect all of the prints below as
62
+ // well.
60
63
stdout ( ) . write ( s. as_bytes ( ) ) ;
61
64
}
62
65
@@ -68,6 +71,20 @@ pub fn println(s: &str) {
68
71
out. write ( [ '\n' as u8 ] ) ;
69
72
}
70
73
74
+ /// Similar to `print`, but takes a `fmt::Arguments` structure to be compatible
75
+ /// with the `format_args!` macro.
76
+ pub fn print_args ( fmt : & fmt:: Arguments ) {
77
+ let mut out = stdout ( ) ;
78
+ fmt:: write ( & mut out as & mut Writer , fmt) ;
79
+ }
80
+
81
+ /// Similar to `println`, but takes a `fmt::Arguments` structure to be
82
+ /// compatible with the `format_args!` macro.
83
+ pub fn println_args ( fmt : & fmt:: Arguments ) {
84
+ let mut out = stdout ( ) ;
85
+ fmt:: writeln ( & mut out as & mut Writer , fmt) ;
86
+ }
87
+
71
88
/// Representation of a reader of a standard input stream
72
89
pub struct StdReader {
73
90
priv inner : ~RtioFileStream
0 commit comments