pub fn from_slice(bytes: &[u8]) -> Result<(*mut u8, usize)>Expand description
copies the memory from the given slice of bytes into a newly allocated pointer
See utf8_rune::pointer::create for details.
Example
use utf8_rune::pointer::{self, from_slice, get_byte_at_index};
let (ptr, length) = from_slice(b"bytes").unwrap();
assert_eq!(get_byte_at_index(ptr, 2), b't');
pointer::destroy(ptr, length).unwrap();