slice-copy

Crates.ioslice-copy
lib.rsslice-copy
version0.3.0
sourcesrc
created_at2018-02-10 07:22:19.338975
updated_at2023-01-04 06:02:50.261127
descriptionGo style copying for slices
homepage
repositoryhttps://github.com/twmb/slice-copy
max_upload_size
id50441
size6,063
Travis Bischel (twmb)

documentation

https://docs.rs/slice-copy

README

slice-copy

Build Status Crates.io Documentation

Go style copying for slices. For times where you would rather use the amount copied to adjust your slices as opposed to determining the amount to copy, adjusting your slices, and finally copying.

use slice_copy::copy;

let mut l = b"hello".to_vec();
let r = b"goodbye".to_vec();

let n = copy(&mut l, &r);

assert_eq!(n, 5);
assert_eq!(l, b"goodb");
Commit count: 10

cargo fmt