Skip to content

Commit 079951e

Browse files
committed
auto merge of #17187 : damag/rust/ffi-guide-fixes, r=alexcrichton
Updates the callbacks section to refer to the right function name and fixes a couple of minor whitespace issues in the examples.
2 parents 13475a0 + d4b2edc commit 079951e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/doc/guide-ffi.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ A basic example is:
209209
Rust code:
210210

211211
~~~~no_run
212-
extern fn callback(a:i32) {
212+
extern fn callback(a: i32) {
213213
println!("I'm called from C with value {0}", a);
214214
}
215215
@@ -243,7 +243,7 @@ void trigger_callback() {
243243
}
244244
~~~~
245245
246-
In this example Rust's `main()` will call `do_callback()` in C,
246+
In this example Rust's `main()` will call `trigger_callback()` in C,
247247
which would, in turn, call back to `callback()` in Rust.
248248
249249
@@ -269,7 +269,7 @@ struct RustObject {
269269
// other members
270270
}
271271
272-
extern "C" fn callback(target: *mut RustObject, a:i32) {
272+
extern "C" fn callback(target: *mut RustObject, a: i32) {
273273
println!("I'm called from C with value {0}", a);
274274
unsafe {
275275
// Update the value in RustObject with the value received from the callback

0 commit comments

Comments
 (0)