(index<- )
./
libstd
/
rt
/
io
/
comm_adapters.rs
1
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2
// file at the top-level directory of this distribution and at
3
// http://rust-lang.org/COPYRIGHT.
4
//
5
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
// option. This file may not be copied, modified, or distributed
9
// except according to those terms.
10
11
use
option::Option
;
12
use
comm::
{
GenericPort
,
GenericChan
};
13
use
super::
{
Reader
,
Writer
};
14
15
struct
PortReader
<P>
;
16
17
impl
<P:
GenericPort<~
[
u8
]>>
PortReader
<
P
>
{
18
pub
fn new
(
_port
:
P
)
->
PortReader<
P
>
{
fail2!
()
}
19
}
20
21
impl
<P:
GenericPort<~
[
u8
]>>
Reader
for
PortReader
<
P
>
{
22
fn read
(
&mut self
,
_buf
:
&mut
[
u8
]
)
->
Option<uint>
{
fail2!
()
}
23
24
fn eof
(
&mut self
)
->
bool
{
fail2!
()
}
25
}
26
27
struct
ChanWriter
<C>
;
28
29
impl
<C:
GenericChan<~
[
u8
]>>
ChanWriter
<
C
>
{
30
pub
fn new
(
_chan
:
C
)
->
ChanWriter<
C
>
{
fail2!
()
}
31
}
32
33
impl
<C:
GenericChan<~
[
u8
]>>
Writer
for
ChanWriter
<
C
>
{
34
fn write
(
&mut self
,
_buf
:
&
[
u8
]
)
{
fail2!
()
}
35
36
fn flush
(
&mut self
)
{
fail2!
()
}
37
}
38
39
struct
ReaderPort
<R>
;
40
41
impl
<R:
Reader
>
ReaderPort
<
R
>
{
42
pub
fn new
(
_reader
:
R
)
->
ReaderPort<
R
>
{
fail2!
()
}
43
}
44
45
impl
<R:
Reader
>
GenericPort
<~
[
u8
]
>
for
ReaderPort
<
R
>
{
46
fn recv
(
&self
)
->
~
[
u8
]
{
fail2!
()
}
47
48
fn try_recv
(
&self
)
->
Option<~
[
u8
]
>
{
fail2!
()
}
49
}
50
51
struct
WriterChan
<W>
;
52
53
impl
<W:
Writer
>
WriterChan
<
W
>
{
54
pub
fn new
(
_writer
:
W
)
->
WriterChan<
W
>
{
fail2!
()
}
55
}
56
57
impl
<W:
Writer
>
GenericChan
<~
[
u8
]
>
for
WriterChan
<
W
>
{
58
fn send
(
&self
,
_x
:
~
[
u8
]
)
{
fail2!
()
}
59
}
libstd/rt/io/comm_adapters.rs:50:1-50:1 -struct- definition:
struct WriterChan<W>;
references:-
53:
impl<W: Writer> WriterChan<W> {
57:
impl<W: Writer> GenericChan<~[u8]> for WriterChan<W> {
54:
pub fn new(_writer: W) -> WriterChan<W> { fail2!() }
libstd/rt/io/comm_adapters.rs:14:1-14:1 -struct- definition:
struct PortReader<P>;
references:-
21:
impl<P: GenericPort<~[u8]>> Reader for PortReader<P> {
18:
pub fn new(_port: P) -> PortReader<P> { fail2!() }
17:
impl<P: GenericPort<~[u8]>> PortReader<P> {
libstd/rt/io/comm_adapters.rs:26:1-26:1 -struct- definition:
struct ChanWriter<C>;
references:-
29:
impl<C: GenericChan<~[u8]>> ChanWriter<C> {
33:
impl<C: GenericChan<~[u8]>> Writer for ChanWriter<C> {
30:
pub fn new(_chan: C) -> ChanWriter<C> { fail2!() }
libstd/rt/io/comm_adapters.rs:38:1-38:1 -struct- definition:
struct ReaderPort<R>;
references:-
45:
impl<R: Reader> GenericPort<~[u8]> for ReaderPort<R> {
42:
pub fn new(_reader: R) -> ReaderPort<R> { fail2!() }
41:
impl<R: Reader> ReaderPort<R> {