-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
I'm looking for an alternative for https://doc.rust-lang.org/std/io/trait.Read.html#method.read_to_string that works with SmallString. So far I haven't found any solutions that doesn't involve additional copies or allocs. I believe an API enhancement is needed somehow. Can you please confirm or otherwise suggest a solution?
I could think of various ways to achieve my goal:
- Implement
std::io::WriteforSmallStringso I can usestd::io::copy(). - Add
SmallString::read<R: Read>(r: &mut R) - Add new constructor
from_small_vec(data: SmallVec<A>). SinceSmallVecalready implementsstd::io::Write, I could usestd::io::copy()again. Not as efficient as the others, be cause this would require to move theSmallVecintoSmallStringwhich is not free. - Add a
smallstr::ReadExttrait which is implemented for allT: Readand provides a methodread_to_small_str().
I would be willing to work on this myself, but would first appreciate a feedback from the crate's maintainer, which way to favor.
Metadata
Metadata
Assignees
Labels
No labels