diff options
author | Bert Belder <bertbelder@gmail.com> | 2018-07-05 19:44:52 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2018-07-12 21:07:20 +0200 |
commit | bbcd4c8dd33121868d82123a3d36e3df282af45f (patch) | |
tree | 0171f96961ef9ca9d38485e8983666e1e44651e5 /src | |
parent | 7e5f0a7a663de3fea0520e40a65872f7704ea262 (diff) |
Remove channel argument from Rust message callback
This makes `deno` not crash any more.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 4441b4005..ece311a4f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,7 +18,7 @@ struct DenoC { _unused: [u8; 0], } -type DenoRecvCb = extern "C" fn(d: *const DenoC, channel: *const c_char, buf: deno_buf); +type DenoRecvCb = extern "C" fn(d: *const DenoC, buf: deno_buf); #[link(name = "deno", kind = "static")] extern "C" { @@ -71,12 +71,8 @@ fn set_flags() -> Vec<String> { .collect::<Vec<_>>() } -extern "C" fn on_message(_d: *const DenoC, channel_ptr: *const c_char, _buf: deno_buf) { - let channel: &str = unsafe { - let cstr = CStr::from_ptr(channel_ptr); - cstr.to_str().unwrap() - }; - println!("got message in rust {}", channel); +extern "C" fn on_message(_d: *const DenoC, _buf: deno_buf) { + println!("got message in rust"); } type DenoException<'a> = &'a str; |