Closed alexheretic closed 2 months ago
To build a SmolStr from parts it would be useful to have a writeable builder.
SmolStr
Perhaps something like
let mut result = SmolStrBuffer::new(); for part in parts { result.push_str(part); } let result = SmolStr::from(result);
This almost already exists provided by smol_str::Writer, but using this has a couple of downsides
smol_str::Writer
Writer
push_str
It seems straightforward to adapt Writer to this end.
Writer was added as an implementation detail for the format_smolstr! macro, but we certainly could expose this with a nice API.
format_smolstr!
To build a
SmolStr
from parts it would be useful to have a writeable builder.Perhaps something like
This almost already exists provided by
smol_str::Writer
, but using this has a couple of downsidesWriter
is hidden from docs, implying it isn't covered by stability guarantees.Writer
doesn't provide infalliblepush_str
, though it trivially could.It seems straightforward to adapt
Writer
to this end.