Execute JS for the first time in Rust rewrite.

Implements code_fetch handler in Rust.

Add ability to embed string assets (for typescript declaration files)

Remove deno_cc and deno_cc_nosnapshot targets.
This commit is contained in:
Ryan Dahl 2018-07-13 03:24:07 -04:00
parent 8a4e3dfda4
commit 3e51605bc9
17 changed files with 514 additions and 205 deletions

View file

@ -20,7 +20,7 @@ struct DenoC {
_unused: [u8; 0],
}
type DenoRecvCb = extern "C" fn(d: *const DenoC, buf: deno_buf);
type DenoRecvCb = unsafe extern "C" fn(d: *const DenoC, buf: deno_buf);
#[link(name = "deno", kind = "static")]
extern "C" {
@ -36,6 +36,8 @@ extern "C" {
fn deno_set_response(d: *const DenoC, buf: deno_buf);
fn deno_execute(d: *const DenoC, js_filename: *const c_char, js_source: *const c_char)
-> c_int;
fn deno_handle_msg_from_js(d: *const DenoC, buf: deno_buf);
}
// Pass the command line arguments to v8.
@ -73,10 +75,6 @@ fn set_flags() -> Vec<String> {
.collect::<Vec<_>>()
}
extern "C" fn on_message(_d: *const DenoC, _buf: deno_buf) {
println!("got message in rust");
}
type DenoException<'a> = &'a str;
struct Deno {
@ -85,7 +83,7 @@ struct Deno {
impl Deno {
fn new() -> Deno {
let ptr = unsafe { deno_new(ptr::null(), on_message) };
let ptr = unsafe { deno_new(ptr::null(), deno_handle_msg_from_js) };
Deno { ptr: ptr }
}