I forked this repository and made a couple of changes that better fit my own use case. Before I keep maintaining them locally, I wanted to ask whether you'd be interested in upstreaming them.
no_std support
I made the crate no_std-compatible (using only core and alloc), which allows it to be used in bare-metal and embedded environments. This is a requirement for my own projects, as I generally design my libraries to avoid depending on std unless it is actually required.
The change itself was fairly small and mostly consisted of replacing std imports with their core/alloc equivalents.
Allow passing &str to Renderer::arg
While integrating the crate, I ran into an issue where Renderer::arg could not accept a &str obtained from APIs such as AsRef<str>::as_ref().
For example:
let s: &str = "hello";
renderer.arg(s); // does not compile
The reason is that the parameter type is &(impl Display + Debug), which implicitly requires the hidden type to be Sized. In this case the compiler infers T = str, which is unsized, even though str implements both Display and Debug.
The existing tests didn't expose this because the string arguments were passed in forms that inferred T = &str (effectively passing &&str), which satisfies the implicit Sized bound.
To fix this, I changed the internal argument representation so that borrowed string slices are handled explicitly while all other values continue to be stored as trait objects. This allows Renderer::arg to accept &str naturally without changing the public API or introducing allocations.
I forked this repository and made a couple of changes that better fit my own use case. Before I keep maintaining them locally, I wanted to ask whether you'd be interested in upstreaming them.
no_stdsupportI made the crate
no_std-compatible (using onlycoreandalloc), which allows it to be used in bare-metal and embedded environments. This is a requirement for my own projects, as I generally design my libraries to avoid depending onstdunless it is actually required.The change itself was fairly small and mostly consisted of replacing
stdimports with theircore/allocequivalents.Allow passing
&strtoRenderer::argWhile integrating the crate, I ran into an issue where
Renderer::argcould not accept a&strobtained from APIs such asAsRef<str>::as_ref().For example:
The reason is that the parameter type is
&(impl Display + Debug), which implicitly requires the hidden type to beSized. In this case the compiler infersT = str, which is unsized, even thoughstrimplements bothDisplayandDebug.The existing tests didn't expose this because the string arguments were passed in forms that inferred
T = &str(effectively passing&&str), which satisfies the implicitSizedbound.To fix this, I changed the internal argument representation so that borrowed string slices are handled explicitly while all other values continue to be stored as trait objects. This allows
Renderer::argto accept&strnaturally without changing the public API or introducing allocations.