You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not aware of an official adapter between the two traits. That said, what is stopping you from writing your own?
use std::io;use std::fmt;pubstructIoFmtWriter<W: io::Write>(pubW);impl<W: io::Write> fmt::WriteforIoFmtWriter<W>{fnwrite_str(&mutself,s:&str) -> fmt::Result{self.0.write_all(s.as_bytes()).map_err(|_| fmt::Error)}}
If that is indeed an option for you, I would assume others are facing the same issue. If so, would you want to create a pull request with an example to this repository?
Yeah, that's an excellent idea! I actually moved to using Tokio so I'll include both a sync and asynchronous example. I'll add it to next-week's TODO list.
I'm providing data directly to a socket. It looks like
encode()
writes tostd::fmt::Write
so it must be written to buffer then sent to the socket.That's serviceable, but seems like a bit of a waste of memory and performance. So, two questions:
encode_stream()
and hide that behind the existingencode()
and friends?The text was updated successfully, but these errors were encountered: