rust/src/libstd/rt/io/comm_adapters.rs

60 lines
1.6 KiB
Rust
Raw Normal View History

// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
2013-08-01 01:12:20 -05:00
use option::Option;
use comm::{GenericPort, GenericChan};
use super::{Reader, Writer};
struct PortReader<P>;
impl<P: GenericPort<~[u8]>> PortReader<P> {
2013-09-27 19:02:31 -05:00
pub fn new(_port: P) -> PortReader<P> { fail2!() }
}
impl<P: GenericPort<~[u8]>> Reader for PortReader<P> {
2013-09-27 19:02:31 -05:00
fn read(&mut self, _buf: &mut [u8]) -> Option<uint> { fail2!() }
2013-09-27 19:02:31 -05:00
fn eof(&mut self) -> bool { fail2!() }
}
struct ChanWriter<C>;
impl<C: GenericChan<~[u8]>> ChanWriter<C> {
2013-09-27 19:02:31 -05:00
pub fn new(_chan: C) -> ChanWriter<C> { fail2!() }
}
impl<C: GenericChan<~[u8]>> Writer for ChanWriter<C> {
2013-09-27 19:02:31 -05:00
fn write(&mut self, _buf: &[u8]) { fail2!() }
2013-09-27 19:02:31 -05:00
fn flush(&mut self) { fail2!() }
}
struct ReaderPort<R>;
impl<R: Reader> ReaderPort<R> {
2013-09-27 19:02:31 -05:00
pub fn new(_reader: R) -> ReaderPort<R> { fail2!() }
}
impl<R: Reader> GenericPort<~[u8]> for ReaderPort<R> {
2013-09-27 19:02:31 -05:00
fn recv(&self) -> ~[u8] { fail2!() }
2013-09-27 19:02:31 -05:00
fn try_recv(&self) -> Option<~[u8]> { fail2!() }
}
struct WriterChan<W>;
impl<W: Writer> WriterChan<W> {
2013-09-27 19:02:31 -05:00
pub fn new(_writer: W) -> WriterChan<W> { fail2!() }
}
impl<W: Writer> GenericChan<~[u8]> for WriterChan<W> {
2013-09-27 19:02:31 -05:00
fn send(&self, _x: ~[u8]) { fail2!() }
}