This repository offers some Rust snippets that can be useful when studying the language.
- vec_any Collect trait objects in a vector and use downcast_ref to access the concrete type instances of the items
- mutate_in_closure Mutate a value in a closure without copy and clone by using Rc
- async structured concurrency Improve developer UX while maintaining a decent performance with async scopes
- async_higher_order_fn Implement an async higher order function that accept an async closures and returns an async result
- from_str Thou shall not implement From<str'> but instead implement the FromStr trait
- graphemes Trim an unicode string to a maximum length with
Dependencies:
- Install the command runner just
- Install the nextest runner cargo-nexttest
- For improved incrememtal build times, install the nightly toolchain to support the cranelift backend:
rustup toolchain install nightly
Run the snippets in debug mode:
just test-all
Run clippy validations and tests in parallel:
just clippy-release & just test-all