I wanted to create a structure containing my read and write buffer, I have tried different approach but i always get Value used after being moved or second mutable borrow occurs here. Is it possible to achieve what i want to do ?
struct MonitorInteraction {
writer: BufWriter<TcpStream>,
reader: BufReader<TcpStream>
}
impl MonitorInteraction {
fn new(tcp_stream: TcpStream) -> MonitorInteraction {
return MonitorInteraction {
writer: BufWriter::new(tcp_stream),
reader: BufReader::new(tcp_stream),
}
}
}