File tree Expand file tree Collapse file tree 5 files changed +27
-8
lines changed
Expand file tree Collapse file tree 5 files changed +27
-8
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,16 @@ jobs:
4141 with :
4242 toolchain : stable
4343 override : true
44+ components : rustfmt
4445
4546 - name : Build the Rust Port
4647 working-directory : source/ports/rs_port
4748 run : cargo build --verbose
4849
50+ - name : Check Rust Formatting
51+ working-directory : source/ports/rs_port
52+ run : cargo fmt --check
53+
4954 - name : Test the Rust Port
5055 working-directory : source/ports/rs_port
5156 env :
Original file line number Diff line number Diff line change @@ -2,9 +2,11 @@ use std::env;
22use std:: path:: PathBuf ;
33
44fn generate_bindings ( ) {
5- let manifest_dir = PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "CARGO_MANIFEST_DIR not set" ) ) ;
6- let output = manifest_dir. join ( "src" ) . join ( "bindings.rs" ) ;
5+ let manifest_dir =
6+ PathBuf :: from ( env:: var ( "CARGO_MANIFEST_DIR" ) . expect ( "CARGO_MANIFEST_DIR not set" ) ) ;
7+ let output = PathBuf :: from ( env:: var ( "OUT_DIR" ) . expect ( "OUT_DIR not set" ) ) . join ( "bindings.rs" ) ;
78 let mut builder = bindgen:: Builder :: default ( )
9+ . raw_line ( "#[cfg_attr(rustfmt, rustfmt::skip)]" )
810 . allowlist_function ( "metacall.*" )
911 . rustified_enum ( "metacall_.*" ) ;
1012
@@ -25,12 +27,22 @@ fn generate_bindings() {
2527 }
2628
2729 builder = builder
28- . clang_arg ( format ! ( "-I{}" , root. join( "source/metacall/include" ) . display( ) ) )
29- . clang_arg ( format ! ( "-I{}" , build_dir. join( "source/metacall/include" ) . display( ) ) )
30+ . clang_arg ( format ! (
31+ "-I{}" ,
32+ root. join( "source/metacall/include" ) . display( )
33+ ) )
34+ . clang_arg ( format ! (
35+ "-I{}" ,
36+ build_dir. join( "source/metacall/include" ) . display( )
37+ ) )
3038 . clang_arg ( format ! ( "-I{}" , build_dir. join( "source/include" ) . display( ) ) ) ;
3139 } else {
3240 let lib = metacall_sys:: find_metacall_library ( ) . unwrap ( ) ;
33- let include = lib. path . parent ( ) . expect ( "library path has no parent" ) . join ( "include" ) ;
41+ let include = lib
42+ . path
43+ . parent ( )
44+ . expect ( "library path has no parent" )
45+ . join ( "include" ) ;
3446 let include_metacall = include. join ( "metacall" ) ;
3547
3648 for entry in std:: fs:: read_dir ( & include_metacall) . expect ( "failed to read include dir" ) {
Original file line number Diff line number Diff line change 1+ edition = " 2021"
Original file line number Diff line number Diff line change @@ -119,4 +119,6 @@ pub mod inline {
119119
120120#[ allow( warnings) ]
121121#[ doc( hidden) ]
122- pub mod bindings;
122+ pub mod bindings {
123+ include ! ( concat!( env!( "OUT_DIR" ) , "/bindings.rs" ) ) ;
124+ }
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ impl MetaCallValue for i64 {
168168 // TODO: This issue happens because we do not have a clear type definition in the Core
169169 // We are not sure yet if we should use fixed sizes in the core, or adapt all the loaders
170170 // and ports to the standard C int type definition. We should define this but it's not yet.
171- // Meanwhile as a workaround, we just panic if it does not fit.
171+ // Meanwhile as a workaround, we just panic if it does not fit.
172172 #[ cfg( any( target_pointer_width = "32" , windows) ) ]
173173 {
174174 unsafe { metacall_value_create_long ( self . try_into ( ) . unwrap ( ) ) }
@@ -177,7 +177,6 @@ impl MetaCallValue for i64 {
177177 {
178178 unsafe { metacall_value_create_long ( self ) }
179179 }
180-
181180 }
182181}
183182/// Equivalent to MetaCall float type.
You can’t perform that action at this time.
0 commit comments