#extension #macro #standard #structures #simplifying

clonelicious

A Rust macro library that simplifies cloning and closure execution. The clone! macro automatically clones variables and immediately executes the closure with the cloned values, streamlining common patterns in Rust programming.

8 stable releases

Uses new Rust 2024

1.1.1 Mar 23, 2025
1.1.0 Mar 20, 2025
1.0.3 Feb 9, 2025
1.0.2 Jan 20, 2025
0.0.2 Jan 17, 2025

#988 in Data structures

Download history 491/week @ 2025-01-17 11/week @ 2025-01-24 52/week @ 2025-01-31 223/week @ 2025-02-07 205/week @ 2025-02-14 127/week @ 2025-02-21 371/week @ 2025-02-28 294/week @ 2025-03-07 400/week @ 2025-03-14 456/week @ 2025-03-21 129/week @ 2025-03-28

1,298 downloads per month
Used in 5 crates (3 directly)

MIT license

6KB

clonelicious

Official Documentation

A Rust macro library that simplifies cloning and closure execution. The clone! macro automatically clones variables and immediately executes the closure with the cloned values, streamlining common patterns in Rust programming.

Installation

To install clonelicious run cmd:

cargo add clonelicious

Usage

use clonelicious::*;
let s1: String = String::from("Hello");
let s2: String = String::from("World");
let res: String = clone!(s1, s2, {
    assert_eq!(s1, String::from("Hello"));
    assert_eq!(s2, String::from("World"));
    format!("{} {}", s1, s2)
});
assert_eq!(res, String::from("Hello World"));

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 ltpp-universe root@ltpp.vip.

No runtime deps