search for: to_rawa

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

Did you mean: to_raw
2019 Jun 05
2
The way of implementing structs of Rust bindings
...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( src: *const guestfs_A ) -> RawA; } struct A { x: String } impl A {...