https://github.com/twmb/slice-copy
Go style copying for slices in Rust
https://github.com/twmb/slice-copy
Last synced: 12 months ago
JSON representation
Go style copying for slices in Rust
- Host: GitHub
- URL: https://github.com/twmb/slice-copy
- Owner: twmb
- License: mit
- Created: 2018-02-10T07:22:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T06:00:15.000Z (over 3 years ago)
- Last Synced: 2025-05-29T10:07:27.794Z (about 1 year ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
slice-copy
==========
[](https://travis-ci.org/twmb/slice-copy) [](https://crates.io/crates/slice-copy) [](https://docs.rs/slice-copy/)
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.
```rust
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");
```