Lines Matching full:code
16 Building the Rust in QEMU code
19 The Rust in QEMU code is included in the emulators via Meson. Meson
21 together with the C code. This is completely automatic when you run
67 code. Note however that you cannot *build* or run tests via ``cargo``, because
68 they need support C code from QEMU that Cargo does not know about. Tests can
101 before QEMU can use them. For now, there is special code in
115 Writing Rust code in QEMU
120 * ``qemu_api`` for bindings to C code and useful functionality
123 writing C code
151 unsafe code; it might have soundness or type-safety issues
254 Almost all Rust code in QEMU will involve QOM objects, and pointers to these
272 Whenever C code provides you with an opaque ``void *``, avoid converting it
279 In particular, device code will usually rely on the ``BqlRefCell`` and
286 Bindings code instead will usually use the ``Opaque`` type, which hides
303 Writing bindings to C code
308 **Look at existing code**
309 Very often, similar idioms in C code correspond to similar tricks in
310 Rust bindings. If the C code uses ``offsetof``, look at qdev properties
311 or ``vmstate``. If the C code has a complex const struct, look at
327 by generic functions. C code usually places metadata in global variables;
343 It's okay to be tricky; device code is written more often than bindings
344 code and it's important that it is idiomatic. However, you should strive
347 toy versions of the code in the documentation.
356 the latter with the ``_or_error`` suffix. The code for the latter is more
389 * Extracting information from Rust source code into traits, typically based
394 Procedural macros can be hard to debug and test; if the code generation
395 exceeds a few lines of code, it may be worthwhile to delegate work to
403 Code should pass clippy and be formatted with rustfmt.