/// allocates string from buffer in heap
allocates string from buffer in heap
allocates string from buffer in heap
pub fn from_buffer(ctxt: &SemContext, buf: &[u8]) -> Handle<Str> {
        let mut handle = str_alloc_heap(ctxt, buf.len());
        handle.length = buf.len();
        unsafe {
            let data = handle.data() as *mut u8;
            // copy buffer content into Str
            ptr::copy_nonoverlapping(buf.as_ptr(), data, buf.len());
        }
        handle
    }
pub fn from_buffer ( ctxt : & SemContext , buf : & [ u8 ] ) -> Handle < Str > { let mut handle = str_alloc_heap ( ctxt , buf . len ( ) ) ; handle . length = buf . len ( ) ; unsafe { let data = handle . data ( ) as * mut u8 ; // copy buffer content into Str ptr :: copy_nonoverlapping ( buf . as_ptr ( ) , data , buf . len ( ) ) ; } handle }
allocates string from buffer in heap
allocates string from buffer in heap
ctxt
&SemContext
buf
&[u8]