[Libguestfs] [PATCH nbdkit] Add support for writing plugins in Rust.
Eric Blake
eblake at redhat.com
Fri Feb 8 14:53:44 UTC 2019
On 2/8/19 5:55 AM, Richard W.M. Jones wrote:
> ---
> +* Consider supporting a more idiomatic style for writing Rust plugins.
> +
Considering I've written nothing in Rust, I'm no good at deciding what
forms idiomatic Rust plugins.
> +++ b/configure.ac
> @@ -545,6 +545,15 @@ AS_IF([test "x$OCAMLOPT" != "xno" && test "x$enable_ocaml" != "xno"],[
> AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLOPT" != "xno" &&
> test "x$ocaml_link_shared" = "xyes"])
>
> +dnl For developing plugins in Rust, optional.
> +AC_CHECK_PROG([CARGO],[cargo],[cargo],[no])
> +AC_ARG_ENABLE([rust],
> + [AS_HELP_STRING([--disable-rust], [disable Rust plugin])],
> + [],
> + [enable_rust=yes])
> +AM_CONDITIONAL([HAVE_RUST],
> + [test "x$CARGO" != "xno" && test "x$enable_ruby" != "xno"])
Copy-and-paste bug: s/ruby/rust/
> @@ -950,8 +951,8 @@ which defines C<$(NBDKIT_PLUGINDIR)> in automake-generated Makefiles.
> =head1 WRITING PLUGINS IN OTHER PROGRAMMING LANGUAGES
>
> You can also write nbdkit plugins in Lua, OCaml, Perl, Python, Ruby,
> -shell script or Tcl. Other programming languages may be offered in
> -future.
> +Rust, shell script or Tcl. Other programming languages may be offered
> +in future.
Pre-existing, s/in/in the/
> +++ b/plugins/rust/Cargo.toml.in
> @@ -0,0 +1,14 @@
> +[package]
> +name = "nbdkit"
> +version = "@VERSION@"
> +authors = ["Richard W.M. Jones <rjones at redhat.com>"]
> +edition = "2018"
2019? Some form of @YEAR@ to make it auto-update from configure results?
> +++ b/plugins/rust/examples/ramdisk.rs
> +
> +// Every plugin must define a public, C-compatible plugin_init
> +// function which returns a pointer to an Plugin struct.
s/an Plugin/a Plugin/
Otherwise, it seems to work (given my lack of Rust knowledge)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190208/b16a80c7/attachment.sig>
More information about the Libguestfs
mailing list