]> git.lizzy.rs Git - rust.git/commitdiff
Update FFI signature table to use pipe format
authorJohn Fresco <john.fresco@utah.edu>
Fri, 25 Apr 2014 19:07:30 +0000 (13:07 -0600)
committerJohn Fresco <john.fresco@utah.edu>
Fri, 25 Apr 2014 19:07:30 +0000 (13:07 -0600)
Rustdoc doesn't seem like it's converting the old format to a table as we can see here:
http://static.rust-lang.org/doc/master/complement-cheatsheet.html#ffi-(foreign-function-interface)
This new format should fix that and it's also rendered by Github's markdown preview.

src/doc/complement-cheatsheet.md

index 784724e9a6cd8ac95583b3a1fa0ef1826a83bd0b..84a000fce5771a08ace00a313ae779040cabd14c 100644 (file)
@@ -207,12 +207,12 @@ let _ = close(Door::<Closed>("front".to_owned())); // error: mismatched types: e
 
 ## C function signature conversions
 
-Description            C signature                                    Equivalent Rust signature
----------------------- ---------------------------------------------- ------------------------------------------
-no parameters          `void foo(void);`                              `fn foo();`
-return value           `int foo(void);`                               `fn foo() -> c_int;`
-function parameters    `void foo(int x, int y);`                      `fn foo(x: c_int, y: c_int);`
-in-out pointers        `void foo(const int* in_ptr, int* out_ptr);`   `fn foo(in_ptr: *c_int, out_ptr: *mut c_int);`
+| Description         | C signature                                   | Equivalent Rust signature                      |
+|---------------------|-----------------------------------------------|------------------------------------------------|
+| no parameters       | `void foo(void);`                             | `fn foo();`                                    |
+| return value        | `int foo(void);`                              | `fn foo() -> c_int;`                           |
+| function parameters | `void foo(int x, int y);`                     | `fn foo(x: c_int, y: c_int);`                  |
+| in-out pointers     | `void foo(const int* in_ptr, int* out_ptr);`  | `fn foo(in_ptr: *c_int, out_ptr: *mut c_int);` |
 
 Note: The Rust signatures should be wrapped in an `extern "ABI" { ... }` block.