Expand description
§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.
§Navigation:
§File path (feature ‘path’):
- macron-path - Creates a new instance of PathBuf
§String operations (feature ‘string’):
- macron-str - Creates a new instance of String
- macron-regex - Creates a new instance of Regex
§IO Input (feature ‘input’):
- macron-input - Reads user input lines from the console
- macron-inputln - Reads user input line from the console
§Collections (feature ‘collections’):
- macron-collections - Creates a new instance of std collections: HashMap, HashSet, BTreeMap, BTreeSet, VecDeque, LinkedList and BinaryHeap
§Derive macros (feature ‘derive’):
- macron-impl-display - The implementation of trait Display
- macron-impl-error - The implementation of trait Error
- macron-impl-from - The implementation of trait From
- macron-impl-into - The implementation of trait Into
§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§
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.