Refactor Readable trait (#3309)
Currently Writable accepts trait Write as a type parameter but Readable takes Read as a trait object, which is not symmetrical and also less performant. This PR changes Readable trait and all places where it's used
This commit is contained in:
+3
-3
@@ -25,7 +25,7 @@ use chrono::prelude::Utc;
|
||||
use rand::{thread_rng, Rng};
|
||||
use std::cmp;
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::BufWriter;
|
||||
use std::io::{BufWriter, Read};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
@@ -51,9 +51,9 @@ impl Protocol {
|
||||
}
|
||||
|
||||
impl MessageHandler for Protocol {
|
||||
fn consume(
|
||||
fn consume<R: Read>(
|
||||
&self,
|
||||
mut msg: Message,
|
||||
mut msg: Message<R>,
|
||||
stopped: Arc<AtomicBool>,
|
||||
tracker: Arc<Tracker>,
|
||||
) -> Result<Option<Msg>, Error> {
|
||||
|
||||
Reference in New Issue
Block a user