Closed Nughm3 closed 2 years ago
As mentioned in the documentation, Rope::from_reader()
and Rope::write_to()
are just convenience functions for basic/toy use cases, not the main way to do input/output when you need specific IO behavior. In general, IO is orthogonal to Ropey, and you're expected to bridge Ropey with whatever IO you need to do.
To that end, the more serious/general counterparts to those convenience functions are RopeBuilder
(for reading into a Rope
) and the Chunks
iterator (for writing out from a Rope
). They don't do or manage IO themselves, but that's the point: they can work with any IO system.
That should allow you load and save Rope
s in an async context. You just need to handle the actual IO part yourself.
Hope that helps!
I've been trying to read from/write to files from a
Rope
. The documentation suggests this:This works well for synchronous programs, but I was unable to find any asynchronous counterpart to
Rope::from_reader
. I tried to usetokio::io::BufReader
, but since that doesn't implementstd::io::Read
(insteadtokio::io::AsyncRead
) it isn't compatible withfrom_reader
.I'm wondering if async support is a possibility, for example something like
Rope::from_reader_async
behind a feature flag.Thanks!