summaryrefslogtreecommitdiff
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-07-18 16:44:09 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-07-19 08:29:26 -0400
commitae393879a7a03643075d559bd2773997c84c7ed0 (patch)
tree450906060b509e83c03d9c14ba92bedeaca209db /src/handlers.rs
parentd93bd4b127c39e2f0e8d2ec3bbec3f7c118890f4 (diff)
cleanup: Move C extern code to src/binding.rs
Diffstat (limited to 'src/handlers.rs')
-rw-r--r--src/handlers.rs23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/handlers.rs b/src/handlers.rs
index a9221a8cb..8929d79de 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -6,7 +6,6 @@ extern crate log;
extern crate url;
use libc::c_char;
-use libc::uint32_t;
use std::ffi::CStr;
use std::ffi::CString;
use std::fs::File;
@@ -14,26 +13,8 @@ use std::io::Read;
use std::path::Path;
use url::Url;
-// TODO(ry) Share this with the def in src/main.rs.
-#[repr(C)]
-pub struct DenoC {
- _unused: [u8; 0],
-}
-
-// TODO(ry) Share this extern block with those in main.rs.
-// See src/reply.h
-extern "C" {
- pub fn deno_reply_error(d: *const DenoC, cmd_id: uint32_t, msg: *const c_char);
- pub fn deno_reply_null(d: *const DenoC, cmd_id: uint32_t);
- pub fn deno_reply_code_fetch(
- d: *const DenoC,
- cmd_id: uint32_t,
- module_name: *const c_char,
- filename: *const c_char,
- source_code: *const c_char,
- output_code: *const c_char,
- );
-}
+mod binding;
+use binding::{deno_reply_code_fetch, deno_reply_error, DenoC};
// TODO(ry) SRC_DIR is just a placeholder for future caching functionality.
static SRC_DIR: &str = "/Users/rld/.deno/src/";