#deprecated #slice #within #copying #copy #safe-wrapper #place

deprecated copy_in_place

[deprecated] a safe wrapper around ptr::copy for efficient copying within slices

5 releases

Uses old Rust 2015

0.2.2 Nov 29, 2022
0.2.1 Aug 15, 2019
0.2.0 Sep 17, 2018
0.1.1 Sep 4, 2018
0.1.0 Aug 26, 2018

#26 in #copying

Download history 2/week @ 2024-02-16 40/week @ 2024-02-23 12/week @ 2024-03-01 6/week @ 2024-03-08 2/week @ 2024-03-15

61 downloads per month
Used in buf-ref-reader

MIT license

6KB
56 lines

copy_in_place

RepoDocsCrate

This crate provides a single function, a safe wrapper around ptr::copy for efficient copying within slices.

DEPRECATED: As of Rust 1.37, the standard library provides the equivalent copy_within method on slices. This crate is deprecated, and it won't receive any further updates or fixes.

Examples

Copying four bytes within a slice:

let mut bytes = *b"Hello, World!";

copy_in_place(&mut bytes, 1..5, 8);

assert_eq!(&bytes, b"Hello, Wello!");

lib.rs:

RepoDocsCrate

This crate provides a single function, a safe wrapper around ptr::copy for efficient copying within slices.

DEPRECATED: As of Rust 1.37, the standard library provides the equivalent copy_within method on slices. This crate is deprecated, and it won't receive any further updates or fixes.

Examples

Copying four bytes within a slice:

let mut bytes = *b"Hello, World!";

copy_in_place(&mut bytes, 1..5, 8);

assert_eq!(&bytes, b"Hello, Wello!");

No runtime deps