no-copy 0.1.2

A simple packer, but no implement copy
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented3 out of 4 items with examples
  • Size
  • Source code size: 11.61 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 500.36 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • A4-Tacks/no-copy-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • A4-Tacks

A simple packer, but no implement copy

This crate originates from the behavior of non move closures when capturing Copy types

Examples

let value;
{
    let n = 2;
    value = || n+1;
}
assert_eq!(value(), 3);

Imagine that it will compile? Actually, it won't

For non move closures, if owned uses a copy types value, it will actually capture the reference

Use NoCopy to make n no longer a copy types, compile passed:

let value;
{
    let n = no_copy::NoCopy(2);
    value = || n+1;
}
assert_eq!(value(), 3);