Skip to content

Commit 7d0191a

Browse files
committed
Initial commit
0 parents  commit 7d0191a

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Generated by Cargo
2+
/target/
3+
Cargo.lock
4+
5+
# Generated by mdbook
6+
/book/book/
7+
8+
# Generated by rustfmt
9+
*.bk
10+
11+
# IDEs / Editor
12+
*.iml
13+
.idea

.rustfmt.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
attributes_on_same_line_as_field = false
2+
attributes_on_same_line_as_variant = false
3+
reorder_imports = true
4+
reorder_import_names = true
5+
reorder_imports_in_group = true
6+
binop_separator = "Back"
7+
#imports_indent = "Block"

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "specs-ffi"
3+
version = "0.1.0"
4+
authors = ["torkleyy <torkleyy@gmail.com>"]
5+
6+
[dependencies]
7+
shred = "0.5"
8+
specs = "0.10"

src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![no_mangle]
2+
3+
extern crate shred;
4+
extern crate specs;
5+
6+
#[repr(C)]
7+
pub struct SpecsWorld(pub specs::World);
8+
9+
pub fn create_world() -> *mut SpecsWorld {
10+
let world = SpecsWorld(specs::World::new());
11+
let world = Box::new(world);
12+
13+
Box::into_raw(world)
14+
}
15+
16+
pub fn free_world(w: *mut SpecsWorld) {
17+
unsafe { Box::from_raw(w); }
18+
}

0 commit comments

Comments
 (0)