Skip to main content

Crate macron

Crate macron 

Source
Expand description

githubcrates-iodocs-rs

§Macros Toolkit

Comprehensive Rust macros toolkit for everyday development tasks. Includes convenient string formatting (str!), regex pattern matching (re!), streamlined collection creation, and custom derive macros for Display, Error, From, and Into traits. Boost your productivity with intuitive syntax and simplify your codebase while maintaining performance and safety. Perfect for both small projects and large-scale applications.

Empower your Rust development with this versatile set of macros, designed to make common tasks easier and more enjoyable.

§File path (feature ‘path’):
§String operations (feature ‘string’):
§IO Input (feature ‘input’):
§Collections (feature ‘collections’):
  • macron-collections - Creates a new instance of std collections: HashMap, HashSet, BTreeMap, BTreeSet, VecDeque, LinkedList and BinaryHeap
§Derive macros (feature ‘derive’):

§Note:

If you need all of this macros, then use feature ‘full’.

§Licensing:

Distributed under the MIT license.

§Feedback:

You can contact me via GitHub or send a message to my Telegram @fuderis.

This library is actively evolving, and your suggestions and feedback are always welcome!

Modules§

extra
prelude

Macros§

arc
Wraps an expression in an Arc::new(). Provides thread-safe shared ownership via Atomic Reference Counting.
arc_mutex
Wraps an expression in an Arc<tokio::sync::Mutex<T>>. The go-to pattern for shared mutable state in async Axum/Tokio apps.
boxed
Wraps an expression in a Box::new(). Moves the value from the stack to the heap.
mutex
Wraps an expression in a tokio::sync::Mutex::new(). Async-aware mutex that doesn’t block the entire thread.
pinned
Wraps an expression in a Box::pin(). Pins the value on the heap, required for self-referential structs and some futures.
std_arc_mutex
Wraps an expression in an Arc<std::sync::Mutex<T>>. Thread-safe shared state using standard blocking primitives.
std_mutex
Wraps an expression in a std::sync::Mutex::new(). Standard blocking mutex for non-async logic or very short critical sections.