It's looking for a Reader impl for @TcpStream, which does not exist. The
implementation is for TcpStream (no @). BufferedReader needs to own its
underlying stream, and therefore takes it by value, not as a shared box. If
you take out the @ when you declare the stream variable it'll compile (with
some warnings that are pretty self-explanatory.)
-Micah
On Oct 15, 2013, at 10:40 PM, Michael Fletcher wrote:
> Hi
>
> I am having problems getting a simple program to compile and i am out of
> ideas.
>
> > problem.rs:13:27: 13:46 error: failed to find an implementation of trait
> > std::rt::io::Reader for @std::rt::io::net::tcp::TcpStream
> > problem.rs:13 let buffered_reader = @BufferedReader::new(stream);
>
> Is there any magic to how a trait impl is located? Is there any specific
> tracing I could enable? Is there a way to dump the symbols out of libstd?
>
>
> ---- cut
> use std::rt::io::Reader;
> use std::rt::io::net::ip::SocketAddr;
> use std::rt::io::net::ip::Ipv4Addr;
> use std::rt::io::net::tcp::TcpStream;
> use std::rt::io::buffered::BufferedReader;
>
> fn main() {
> let ip = Ipv4Addr(192, 168, 0, 113);
> let addr = SocketAddr{ip:ip, port:80};
> let mut stream = @TcpStream::connect(addr).unwrap();
>
> // problem.rs:13:27: 13:46 error: failed to find an implementation of
> trait std::rt::io::Reader for @std::rt::io::net::tcp::TcpStream
> // problem.rs:13 let buffered_reader = @BufferedReader::new(stream);
> let buffered_reader = @BufferedReader::new(stream);
> }
> ---- end cut
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev