clone-block 0.1.1

A very simple macro that clones a list of variables before calling an expression
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented2 out of 2 items with examples
  • Size
  • Source code size: 23.72 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.02 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • r3v2d0g

A very simple macro that clones a list of variables before calling an expression

img img img

Based on this tweet: https://twitter.com/untitaker/status/1299812136202493953

use clone_block::clone;
use std::thread;

let foo = "foo".to_string();

let thread = thread::spawn(
    clone!(foo; move || {
        let foobar = format!("{}bar", foo);
        foobar
    })
);

let foobar = thread.join();
let foobaz = format!("{}baz", foo);

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.