doc: Fix table format in cheatsheet

This commit is contained in:
Brian Anderson 2014-01-07 12:04:14 -08:00
parent a61d7d6dbe
commit 3100bb424c

View File

@ -165,12 +165,12 @@ let _ = close(Door::<Closed>(~"front")); // error: mismatched types: expected `m
## 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: int, y: 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: int, y: 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.