diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-07-06 11:27:36 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-07-06 17:33:06 -0400 |
commit | 9778eceaf5922b1e051859a68b2e02a2f1b1ee8b (patch) | |
tree | 680eac7b09e0a9fe6a6a76fb8462fdc4b8ac101d /src/handlers.rs | |
parent | d9cb093989263b7e57a43d9ef18d88da7a77a784 (diff) |
Use C++ to do flatbuffer parsing.
- Port protobuf messages to flatbuffers.
- Demo linking to rust from C++ executable.
- Start using the prototype TS libraries.
Diffstat (limited to 'src/handlers.rs')
-rw-r--r-- | src/handlers.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/handlers.rs b/src/handlers.rs new file mode 100644 index 000000000..64a076f11 --- /dev/null +++ b/src/handlers.rs @@ -0,0 +1,27 @@ +// Copyright 2018 Ryan Dahl <ry@tinyclouds.org> +// All rights reserved. MIT License. +extern crate libc; + +use libc::c_char; +use std::ffi::CStr; + +fn string_from_ptr(ptr: *const c_char) -> String { + let cstr = unsafe { CStr::from_ptr(ptr as *const i8) }; + String::from(cstr.to_str().unwrap()) +} + +#[no_mangle] +pub extern "C" fn handle_code_fetch( + module_specifier: *const c_char, + containing_file: *const c_char, +) { + let module_specifier = string_from_ptr(module_specifier); + let containing_file = string_from_ptr(containing_file); + + println!( + "handle_code_fetch. module_specifier = {} containing_file = {}", + module_specifier, containing_file + ); + + unimplemented!(); +} |