[Libguestfs] [PATCH 4/9] Rust bindings: Add generator of structs

Richard W.M. Jones rjones at redhat.com
Thu Jun 27 08:48:45 UTC 2019


On Thu, Jun 27, 2019 at 05:06:05PM +0900, Hiroyuki Katsura wrote:
> From: Hiroyuki_Katsura <hiroyuki.katsura.0513 at gmail.com>
> 
> ---
>  generator/rust.ml | 87 +++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 85 insertions(+), 2 deletions(-)
> 
> diff --git a/generator/rust.ml b/generator/rust.ml
> index 251eb1594..174f6ded3 100644
> --- a/generator/rust.ml
> +++ b/generator/rust.ml
> @@ -29,13 +29,21 @@ open Structs
>  open C
>  open Events
>  
> +let rec indent n = match n with
> +  | x when x > 0 -> pr "    "; indent (x - 1)
> +  | _ -> ()
>  
>  let generate_rust () =
>    generate_header CStyle LGPLv2plus;
>  
>    pr "
> +use std::ffi;
> +use std::slice;
> +use std::os::raw::c_char;
> +
> +

Extra blank line here.

>  #[allow(non_camel_case_types)]
> -enum guestfs_h {}
> +enum guestfs_h {}  // opaque struct
>  
>  #[link(name = \"guestfs\")]
>  extern \"C\" {
> @@ -119,5 +127,80 @@ impl Handle {
>              Ok(Handle { g })
>          }
>      }
> +}\

Did you mean to put a \ at the end of this line?  It causes the OCaml
compiler to ignore the following newline, which is probably the wrong
thing.

This patch is fine apart from where noted above.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list