copy

Function copy 

Source
pub fn copy(src: *const u8, length: usize) -> Result<*mut u8>
Expand description

copies the memory contents of src into a newly allocated pointer

See utf8_rune::pointer::create for details.

Example

use utf8_rune::pointer::{self, from_display, get_byte_at_index, copy};
let (ptr, length) = from_display("bytes").unwrap();
let other_ptr = copy(ptr, length).unwrap();
assert_eq!(get_byte_at_index(ptr, 2), b't');
pointer::destroy(ptr, length).unwrap();
pointer::destroy(other_ptr, length).unwrap();