Struct js::jsapi::SourceBufferHolder
[−]
[src]
#[repr(C)]pub struct SourceBufferHolder { pub data_: *const c_ushort, pub length_: usize, pub ownsChars_: bool, }
Container class for passing in script source buffers to the JS engine. This not only groups the buffer and length values, it also provides a way to optionally pass ownership of the buffer to the JS engine without copying. Rules for use:
1) The data array must be allocated with js_malloc() or js_realloc() if ownership is being granted to the SourceBufferHolder. 2) If ownership is not given to the SourceBufferHolder, then the memory must be kept alive until the JS compilation is complete. 3) Any code calling SourceBufferHolder::take() must guarantee to keep the memory alive until JS compilation completes. Normally only the JS engine should be calling take().
Example use:
size_t length = 512;
char16_t* chars = static_cast
Fields
data_: *const c_ushort
length_: usize
ownsChars_: bool