std-macro-extensions
A collection of macro extensions for Rust's standard library data structures, simplifying the creation and manipulation of common collections such as HashMap
, Vec
, and more.
Features
- Simplified Initialization: Use macros to easily create instances of common data structures.
- Supports Various Data Structures: Includes macros for
Vec
,HashMap
,Arc
, and more. - Easy to Use: Intuitive syntax for quick data structure creation.
Installation
To install std-macro-extensions
run cmd:
Usage
Here are some examples of how to use the macros provided by this crate:
Example: Using arc!
use *;
Example: Using b_tree_map!
use *;
Example: Using b_tree_set!
use *;
Example: Using binary_heap!
use *;
Example: Using boxed!
use *;
Example: Using cell!
use *;
Example: Using hash_map!
use *;
Example: Using hash_set!
use *;
Example: Using linked_list!
use *;
Example: Using mutex!
use *;
Example: Using rc!
use *;
Example: Using refcell!
use *;
Example: Using rw_lock!
use *;
Example: Using string!
use *;
Example: Using vector!
use *;
Example: Using vector_deque!
use *;
Example: Using join_paths!
let combined_path: String = join_paths!;
let another_path: String = join_paths!;
Example: Using cin!
let input: String = cin!;
println!;
Example: Using cin_parse!
let input: &str = "1 2 3";
let numbers: = cin_parse!;
assert_eq!;
let single_input: &str = "12";
let number: i32 = cin_parse!;
assert_eq!;
Example: Using cout!
let name: &str = "Alice";
let age: i32 = 30;
cout!;
Example: Using endl!
endl!;
Example: Using cout_endl!
let name: &str = "Alice";
let age: i32 = 30;
cout_endl!;
Example: Using execute!
let nums: = vec!;
let total: i32 = execute!;
assert_eq!;
let total_with_offset: i32 = execute!;
assert_eq!;
Available Macros
arc!
: Creates anArc<T>
.vector!
: Creates aVec<T>
.map!
: Creates aHashMap<K, V>
.set!
: Creates aHashSet<T>
.b_tree_map!
: Creates aBTreeMap<K, V>
.b_tree_set!
: Creates aBTreeSet<T>
.list!
: Creates aLinkedList<T>
.heap!
: Creates aBinaryHeap<T>
.string!
: Creates aString
.boxed!
: Creates aBox<T>
.rc!
: Creates anRc<T>
.arc!
: Creates anArc<T>
.mutex!
: Creates aMutex<T>
.rw_lock!
: Creates aRwLock<T>
.cell!
: Creates aCell<T>
.ref_cell!
: Creates aRefCell<T>
.vector_deque!
: Creates aVecDeque<T>
.join_paths!
: Combines multiple paths into a single valid path, handling overlapping slashes.cin!
: Reads a line of input from the standard input.cin_parse!
: Parses input into a specified type.cout!
: Prints formatted output to the standard output.endl!
: Prints a newline character to the standard output.cout_endl!
: Prints formatted output followed by a newline character to the standard output.execute!
: Executes a function with the provided arguments.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Contact
For any inquiries, please reach out to the author at root@ltpp.vip.