messagepack-rs icon indicating copy to clipboard operation
messagepack-rs copied to clipboard

Deserializer should accept pure `Read` trait

Open suma opened this issue 5 years ago • 1 comments

I want to use Deserializer for stdin(below code) but it is impossible because Deserializer requires Seek trait. Do you have any plans for Deserializer update?

{
    let stdin = io::stdin();
    let input = stdin.lock();
    let mut reader = BufReader::new(input);
    let mut stream_deserializer = Deserializer::new(reader);
    // deserialize repeatedly...
}

IMO, if Deserializer inputs pure Read, it can accept any stream object e.g. socket(TcpStream). The implementation might be like MessagePack.newDefaultUnpacker(InputStream in) of msgpack-java. Thanks!

suma avatar Dec 18 '19 15:12 suma

Sorry for the late reply. I found a way to improve it, but it's difficult to respond immediately because it requires making a lot of changes, including breaking changes...

otake84 avatar Nov 25 '21 11:11 otake84