Add Crystal to Rust example.
This commit is contained in:
6
crystal-to-rust/src/double.cr
Normal file
6
crystal-to-rust/src/double.cr
Normal file
@@ -0,0 +1,6 @@
|
||||
@[Link("double_input")]
|
||||
lib RustLib
|
||||
fun double_input(input: Int32) : Int32
|
||||
end
|
||||
|
||||
puts RustLib.double_input(2)
|
||||
4
crystal-to-rust/src/lib.rs
Normal file
4
crystal-to-rust/src/lib.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
#[no_mangle]
|
||||
pub extern "C" fn double_input(input: i32) -> i32 {
|
||||
input * 2
|
||||
}
|
||||
Reference in New Issue
Block a user