Crates.io | slice-copy |
lib.rs | slice-copy |
version | 0.3.0 |
source | src |
created_at | 2018-02-10 07:22:19.338975 |
updated_at | 2023-01-04 06:02:50.261127 |
description | Go style copying for slices |
homepage | |
repository | https://github.com/twmb/slice-copy |
max_upload_size | |
id | 50441 |
size | 6,063 |
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");