Show HN: Static_str_ops: &'static str and non-const operations in Rust

It is often asked by Rust programmer that how to create `&'static str` in Rust with non-const operations at runtime, e.g., returns the result of `format!()` as `&'static str`, rather than `String`.

The crate static_str_ops addressed this issue, by allocating a hash set under the hood, and return the reference as the result. Along with this crate, a set of utilities are provided, including `static_format!`, `static_concat!`, and `staticize_once!` which can be used to initialize static strings with the `call_once` semantic.

2 points sighingnow 3 years ago 0 comments

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton