[go: up one dir, main page]

Skip to content

Commit

Permalink
Convert ffi, ffi/tests/ctests and wasm crates to Rust 2018 (cloudflar…
Browse files Browse the repository at this point in the history
  • Loading branch information
marmeladema authored Apr 12, 2019
1 parent d53d475 commit 3813d66
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 23 deletions.
1 change: 1 addition & 0 deletions ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name = "wirefilter-ffi"
version = "0.6.1"
description = "FFI bindings for the Wirefilter engine"
publish = false
edition = "2018"

[package.metadata.deb]
assets = [["target/release/libwirefilter_ffi.so", "usr/local/lib/libwirefilter.so", "644"]]
Expand Down
19 changes: 4 additions & 15 deletions ffi/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
extern crate fnv;
extern crate libc;
extern crate serde_json;
extern crate wirefilter;

#[cfg(test)]
extern crate regex;

#[cfg(test)]
extern crate indoc;

pub mod transfer_types;

use crate::transfer_types::{
ExternallyAllocatedByteArr, ExternallyAllocatedStr, RustAllocatedString, RustBox,
StaticRustAllocatedString,
};
use fnv::FnvHasher;
use std::{
hash::Hasher,
io::{self, Write},
net::IpAddr,
};
use transfer_types::{
ExternallyAllocatedByteArr, ExternallyAllocatedStr, RustAllocatedString, RustBox,
StaticRustAllocatedString,
};
use wirefilter::{ExecutionContext, Filter, FilterAst, ParseError, Scheme, Type};

const VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down
2 changes: 1 addition & 1 deletion ffi/src/transfer_types/ownership_repr/reference.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::transfer_types::raw_ptr_repr::ExternPtrRepr;
use std::marker::PhantomData;
use transfer_types::raw_ptr_repr::ExternPtrRepr;

#[repr(transparent)]
pub struct Ref<'a, T: ?Sized + ExternPtrRepr> {
Expand Down
2 changes: 1 addition & 1 deletion ffi/src/transfer_types/ownership_repr/rust_box.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::transfer_types::raw_ptr_repr::ExternPtrRepr;
use std::{
marker::PhantomData,
mem,
ops::{Deref, DerefMut},
};
use transfer_types::raw_ptr_repr::ExternPtrRepr;

#[repr(transparent)]
pub struct RustBox<T: ?Sized + ExternPtrRepr> {
Expand Down
1 change: 1 addition & 0 deletions ffi/tests/ctests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name = "wirefilter-ffi-ctests"
version = "0.1.0"
description = "C based tests for FFI bindings of the Wirefilter engine"
publish = false
edition = "2018"

[dependencies]
wirefilter-ffi = {path = "../.."}
Expand Down
2 changes: 1 addition & 1 deletion ffi/tests/ctests/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extern crate cc;
use cc;

fn main() {
cc::Build::new()
Expand Down
2 changes: 1 addition & 1 deletion ffi/tests/ctests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extern crate wirefilter_ffi as _;
use wirefilter_ffi as _;

#[no_mangle]
unsafe extern "C" fn rust_assert(check: bool, msg: *const std::os::raw::c_char) {
Expand Down
1 change: 1 addition & 0 deletions wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name = "wirefilter-wasm"
version = "0.6.1"
description = "WebAssembly bindings for the Wirefilter engine"
publish = false
edition = "2018"

[lib]
crate-type = ["cdylib"]
Expand Down
4 changes: 0 additions & 4 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate js_sys;
extern crate wasm_bindgen;
extern crate wirefilter;

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
Expand Down

0 comments on commit 3813d66

Please sign in to comment.