no-copy

Crates.iono-copy
lib.rsno-copy
version0.1.2
created_at2025-08-13 14:52:24.412172+00
updated_at2026-01-16 16:31:32.202409+00
descriptionA simple packer, but no implement copy
homepage
repositoryhttps://github.com/A4-Tacks/no-copy-rs
max_upload_size
id1793693
size11,616
A4-Tacks (A4-Tacks)

documentation

README

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);
Commit count: 3

cargo fmt