ogham / rust-ansi-term

Rust library for ANSI terminal colours and styles (bold, underline)

Home Page:https://crates.io/crates/ansi_term

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

recommendation for printing single chars

softprops opened this issue · comments

Thanks for putting together such a nice crate. I wanted to ask for suggestion path for an usage issue I ran into. I ran into an issue where I wanted to paint a single char but was forced to allocate a new string to machine requirements with the Color#paint method. I was wondering if you had suggestions for an alternate approach.

Dunno if you ever solved your issue, but https://doc.rust-lang.org/std/primitive.char.html#method.encode_utf8 does what you want using a buffer on the stack.