from_display

Function from_display 

Source
pub fn from_display<T: Display>(input: T) -> Result<(*mut u8, usize)>
Expand description

copies the memory from the underlying slice of bytes of the given input into a newly allocated pointer.

See utf8_rune::pointer::create for details.

Example

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