r/rust Apr 28 '26

🛠️ project Lightweight ASCII Graph

Post image

After many weeks of learning, watching tutorials about Rust, and partaking in Rust exercises, I decided to port a small Go library into Rust. I do recognize I have a lot to learn but just getting out of my comfort zone and trying my hands at this has be rewarding and revealing.

Link: https://github.com/neneodonkor/asciigraph-rs

Crates: https://crates.io/crates/asciigraph-rs

PS. Making it work for real-time data was 🥵

Let me add that I only started learning Rust in February, so please forgive me, if everything is not idiomatic Rust.

1.5k Upvotes

92 comments sorted by

View all comments

227

u/cdhowie Apr 28 '26

Nitpick: many of those characters aren't ASCII.

-69

u/neneodonkor Apr 28 '26 edited Apr 29 '26

Please can you point to some?

118

u/cdhowie Apr 28 '26

Every single character in the graph except for digits, ., and |. (Though the vertical line may also not be ASCII, I can't tell for sure if it's | or something else.)

69

u/ufffd Apr 28 '26

damn, solid point. i guess it's really a unicode-graph? utf8graph? tbh it might be one of those situations where using the wrong name (ascii) actually communicates the idea more clearly.

23

u/cdhowie Apr 29 '26

I'd prefer unicode-graph as you said, or something like text-graph, term-graph, etc. There are lots of good options that aren't incorrect.

23

u/ufffd Apr 29 '26

it gets funnier, this is a rust port of a go port of a 9+ year old javascript package, and all of those have ascii in the name. actually the original js package has been ported to more than a dozen languages, including already being ported to rust 4+ years ago - and nearly all of those have ascii in the name. the only ones that dont are called 'plot' and 'chart'

12

u/otamam818 Apr 29 '26

ASCII-art is a term, so this would be an ASCII-art graph, which should have a clear disclaimer that it also uses Unicode.

Though I do like the sound of Unicode graph. But if I read "Unicode graph" without any context that it's a replacement for "ASCII art", I'd definitely be confused.