2018-04-04 22:08:10 -05:00
|
|
|
// run-pass
|
|
|
|
|
|
|
|
use std::io::Result;
|
|
|
|
|
|
|
|
struct Foo {}
|
|
|
|
|
|
|
|
pub trait FakeRead {
|
|
|
|
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl FakeRead for Foo {
|
2019-09-01 16:30:19 -05:00
|
|
|
fn read_to_end(&mut self, _buf: &mut Vec<u8>) -> Result<usize> {
|
2018-04-04 22:08:10 -05:00
|
|
|
Ok(4)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut a = Foo {};
|
|
|
|
let mut v = Vec::new();
|
2019-09-01 16:30:19 -05:00
|
|
|
a.read_to_end(&mut v).unwrap();
|
2018-04-04 22:08:10 -05:00
|
|
|
}
|