We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 188167c commit 67d83acCopy full SHA for 67d83ac
doc/guide-ffi.md
@@ -329,6 +329,12 @@ channel where the writing end (`Chan`) is used exclusively from the C callback
329
to queue events. The reading end (`Port`) is used in the Rust task which owns
330
the wrapper object.
331
332
+Depending on the type of data in the event you might want to convert callback
333
+data from C into a more suitable Rust structure before sending it into the
334
+channel. E.g. it makes sense to convert C strings (`char*`) into Rust strings.
335
+You could also use Rust enumerations to differentiate between multiple types
336
+of events and their data.
337
+
338
Putting this together a wrapper for a library that uses a background thread
339
that sends events could look like:
340
0 commit comments