@@ -173,7 +173,7 @@ the same stack as the rust stack. This means that there is no extra
173
173
stack-switching mechanism in place because it is assumed that the large stack
174
174
for the rust task is plenty for the C function to have.
175
175
176
- A planned future improvement (net yet implemented at the time of this writing)
176
+ A planned future improvement (not yet implemented at the time of this writing)
177
177
is to have a guard page at the end of every rust stack. No rust function will
178
178
hit this guard page (due to Rust's usage of LLVM's ` __morestack ` ). The intention
179
179
for this unmapped page is to prevent infinite recursion in C from overflowing
@@ -201,7 +201,7 @@ It is possible to pass functions defined in Rust to an external library.
201
201
The requirement for this is that the callback function is marked as ` extern `
202
202
with the correct calling convention to make it callable from C code.
203
203
204
- The callback function that can then be sent to through a registration call
204
+ The callback function can then be sent through a registration call
205
205
to the C library and afterwards be invoked from there.
206
206
207
207
A basic example is:
@@ -243,14 +243,14 @@ void trigger_callback() {
243
243
}
244
244
~~~~
245
245
246
- In this example will Rust's `main()` will call `do_callback()` in C,
247
- which would call back to `callback()` in Rust.
246
+ In this example Rust's `main()` will call `do_callback()` in C,
247
+ which would, in turn, call back to `callback()` in Rust.
248
248
249
249
250
- ## Targetting callbacks to Rust objects
250
+ ## Targeting callbacks to Rust objects
251
251
252
252
The former example showed how a global function can be called from C code.
253
- However it is often desired that the callback is targetted to a special
253
+ However it is often desired that the callback is targeted to a special
254
254
Rust object. This could be the object that represents the wrapper for the
255
255
respective C object.
256
256
@@ -334,7 +334,7 @@ it is also absolutely necessary that no more callbacks are performed by the
334
334
C library after the respective Rust object gets destroyed.
335
335
This can be achieved by unregistering the callback in the object's
336
336
destructor and designing the library in a way that guarantees that no
337
- callback will be performed after unregistration .
337
+ callback will be performed after deregistration .
338
338
339
339
# Linking
340
340
0 commit comments