search for: guestfs_a

Displaying 1 result from an estimated 1 matches for "guestfs_a".

Did you mean: guestfs_h
2019 Jun 05
2
The way of implementing structs of Rust bindings
...f API struct. When the way struct is structured changes in API, you have to modify Rust bindings. In order to avoid this situation, you can define the same struct in C and Rust and then access the API struct in C and then Rust accesses the data through this struct. This means that ``` API: struct guestfs_A: - field: x FString C: struct RawA { char* x }; struct RawA to_RawA(struct guestfs_A* src) { struct RawA x = {src->x}; return x; } Rust: #repr(C) use std::ffi::CStr; use std::str; #[repr(C)] struct RawA { x: *const i8 } enum guestfs_A {} // opaque struct extern { fn to_RawA( s...