[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH nbdkit] Add support for writing plugins in Rust.



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 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

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]