Rust code to image

Turn a Rust snippet into a polished image with lifetimes, traits, and macros all clearly highlighted. Rust reads densely, so framing a function as an image makes the borrows and matches much easier to follow. The picture is built on the page, so your crate code is never uploaded.

What you can do with a Rust snippet

  • Share an idiomatic pattern match or iterator chain
  • Add a clean example to a crate README or docs.rs page
  • Illustrate an ownership concept in a write-up

A Rust example

Here it is in the Ember theme — one of dozens. Open it in the editor to try others, tweak the background, and export, or paste your own Rust in its place.

main.rs
1fn largest<T: PartialOrd>(list: &[T]) -> &T {
2 let mut max = &list[0];
3 for item in list {
4 if item > max {
5 max = item;
6 }
7 }
8 max
9}

Your code stays on your device

gilika is built to render your Rust into an image right in your browser, so the snippet never has to be uploaded to a server. See exactly how.