parent
80c60941d6
commit
94c358c535
|
@ -71,8 +71,10 @@ use core::{fmt, mem, ptr, slice, str};
|
||||||
pub fn write<W: io::Write, V: Integer>(mut wr: W, value: V) -> io::Result<usize> {
|
pub fn write<W: io::Write, V: Integer>(mut wr: W, value: V) -> io::Result<usize> {
|
||||||
let mut buf = Buffer::new();
|
let mut buf = Buffer::new();
|
||||||
let s = buf.format(value);
|
let s = buf.format(value);
|
||||||
try!(wr.write_all(s.as_bytes()));
|
match wr.write_all(s.as_bytes()) {
|
||||||
Ok(s.len())
|
Ok(()) => Ok(s.len()),
|
||||||
|
Err(e) => Err(e),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write integer to an `fmt::Write`.
|
/// Write integer to an `fmt::Write`.
|
||||||
|
@ -114,6 +116,7 @@ impl Buffer {
|
||||||
/// This is a cheap operation; you don't need to worry about reusing buffers
|
/// This is a cheap operation; you don't need to worry about reusing buffers
|
||||||
/// for efficiency.
|
/// for efficiency.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn new() -> Buffer {
|
pub fn new() -> Buffer {
|
||||||
Buffer {
|
Buffer {
|
||||||
bytes: unsafe { mem::uninitialized() },
|
bytes: unsafe { mem::uninitialized() },
|
||||||
|
|
Loading…
Reference in New Issue