use newtype struct for devnull rather than type aliased record
This commit is contained in:
parent
7c79b5e434
commit
af48f30542
1 changed files with 3 additions and 3 deletions
|
@ -96,9 +96,9 @@ fn chanmb(i: uint, size: uint) -> Line
|
||||||
Line {i:i, b:crv}
|
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 write(&self, _b: &[const u8]) {}
|
||||||
fn seek(&self, _i: int, _s: io::SeekStyle) {}
|
fn seek(&self, _i: int, _s: io::SeekStyle) {}
|
||||||
fn tell(&self) -> uint {0_u}
|
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 {
|
let cout: io::Writer = match path {
|
||||||
~"" => {
|
~"" => {
|
||||||
{dn: 0} as io::Writer
|
Devnull as io::Writer
|
||||||
}
|
}
|
||||||
~"-" => {
|
~"-" => {
|
||||||
io::stdout()
|
io::stdout()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue