1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
//! Facilities for working with `v8::String`s.

use raw::{Local, Isolate};

extern "C" {

    /// Mutates the `out` argument provided to refer to a newly created `v8::String`. Returns
    /// `false` if the value couldn't be created.
    #[link_name = "Neon_String_New"]
    pub fn new(out: &mut Local, isolate: *mut Isolate, data: *const u8, len: i32) -> bool;

    /// Gets the length of a `v8::String`.
    #[link_name = "Neon_String_Utf8Length"]
    pub fn utf8_len(str: Local) -> isize;

    /// Writes data to a `v8::String` and returns the number of bytes writen.
    #[link_name = "Neon_String_Data"]
    pub fn data(out: *mut u8, len: isize, str: Local) -> isize;

}