use newtype struct for devnull rather than type aliased record

This commit is contained in:
Ted Horst 2012-12-30 11:54:44 -06:00 committed by Tim Chevalier
parent 7c79b5e434
commit af48f30542

View File

@ -96,9 +96,9 @@ fn chanmb(i: uint, size: uint) -> Line
Line {i:i, b:crv}
}
type devnull = {dn: int};
struct Devnull();
impl devnull: io::Writer {
impl Devnull: io::Writer {
fn write(&self, _b: &[const u8]) {}
fn seek(&self, _i: int, _s: io::SeekStyle) {}
fn tell(&self) -> uint {0_u}
@ -110,7 +110,7 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
{
let cout: io::Writer = match path {
~"" => {
{dn: 0} as io::Writer
Devnull as io::Writer
}
~"-" => {
io::stdout()