You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King, III" <jk...@apache.org> on 2017/11/19 20:16:48 UTC

I need help with RUST (THRIFT-4390)

I don't know rust at all, and it's really different from other languages I
am used to.

I need to change the socket.rs from write() to write_all() however this
changes the returned result from a number to a void:

impl Write for TTcpChannel {
    fn write(&mut self, b: &[u8]) -> io::Result<usize> {
        self.if_set(|s| s.write*_all*(b))
    }

    fn flush(&mut self) -> io::Result<()> {
        self.if_set(|s| s.flush())
    }
}

How do I code up, "and return b.len()" in rust so that it always returns
the length of b?
Thanks,

Jim