Eliminates need to box response reader

I don't know how idiomatic this is for rust, but the only way I could think of to do this is with a union enum and generics. As the number of decoders should never be more than a few, this shouldn't really be a problem.
This commit is contained in:
Sam Gibson 2015-08-16 14:44:53 +10:00
parent 879b058be2
commit 6064ee8756
2 changed files with 29 additions and 11 deletions

View file

@ -496,7 +496,7 @@ fn test_load_follows_a_redirect() {
match load::<MockRequest>(load_data, resource_mgr, None, &Factory) {
Err(_) => panic!("expected to follow a redirect"),
Ok(mut lr) => {
let response = read_response(&mut *lr.reader);
let response = read_response(&mut lr);
assert_eq!(response, "Yay!".to_string());
}
}