7 Commits

Author SHA1 Message Date
Jacob Reger
f81444ccad libguestfs: Rust binding build error and warning fixes
Internal error type did not implement the necessary traits to be
treated as a proper Rust error. This would cause ergonomic issues
with manual error handling and with error handling crates like
anyhow. Implement the Display and Error trait for internal Error
type. This also fixes the build warnings.

Signed-off-by: Jacob Reger <regerjacob@gmail.com>
2025-02-25 22:00:12 +00:00
Jacob Reger
d7d5264ce8 libguestfs: Rust binding build error and warning fixes
Fixed break in Rust bindings where callback registering expected a
*const i8, but were provided with a *const c_char. Changed to be both
*const c_char in alignment with the libguestfs documentation.

Signed-off-by: Jacob Reger <regerjacob@gmail.com>
2025-02-25 21:53:36 +00:00
Jürgen Hötzel
43946911c7 rust: Handle null pointer when creating slice
Starting with Rust 1.78 null assertions in the standard library are
now checked when compiling in test/debug mode.

Fixes: https://github.com/libguestfs/libguestfs/issues/145
2024-06-20 13:27:51 +01:00
Richard W.M. Jones
d01ce08218 rust: Fix deprecated use of panic!(format!(...))
warning: panic message is not a string literal
 --> src/bin/event_leak.rs:9:30
  |
9 |             Err(e) => panic!(format!(" could not create handle {:?}", e)),
  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(non_fmt_panic)]` on by default
  = note: this is no longer accepted in Rust 2021
  = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2021-05-05 12:57:51 +01:00
Hiroyuki Katsura
3f7ff1b068 Rust bindings: Implement callback handlers
This patch includes:

- Event callback handlers
- Tests related to events(410-430)

src/bin/event.rs and src/bin/event_leak.rs
are the PoCs that Boxes related to callbacks are
not leaked.
2019-08-06 14:54:04 +01:00
Hiroyuki Katsura
bb0cb3e730 Rust bindings: Add Event structs, Clarify Handle lifetime
Without clarifying handle's lifetime, it is unable
to see how long the callbacks which the handle
owns will live. Then, Rust compiler will infer
that the callbacks have 'static lifetime. It is
not convenient for users.
2019-08-06 14:54:04 +01:00
Hiroyuki_Katsura
3bbd00c83e Rust bindings: Add Rust bindings
This patch includes Actions and their tests. Missing:

- Events
- Examples

Rust bindings: Add create / close functions

Rust bindings: Add 4 bindings tests

Rust bindings: Add generator of structs

Rust bindings: Add generator of structs for optional arguments

Rust bindings: Add generator of function signatures

Rust bindings: Complete actions

Rust bindings: Fix memory management

Rust bindings: Add bindtests

Rust bindings: Add additional 4 bindings tests

Rust bindings: Format test files

Rust bindings: Incorporate bindings to build system
2019-07-29 10:28:31 +01:00