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

Re: [Libguestfs] [libnbd PATCH] RFC: Add bindings for Rust language

On Mon, Jul 08, 2019 at 12:37:56PM +0200, Martin Kletzander wrote:
> On Mon, Jul 08, 2019 at 10:36:30AM +0100, Richard W.M. Jones wrote:
> >On Mon, Jul 08, 2019 at 11:20:44AM +0200, Martin Kletzander wrote:
> >>Maybe some substrings could be identified to be common and then
> >>copied from a file instead of duplicating the data.  But this is not
> >>needed.
> >
> >I'm a bit unclear what "strings" (above) and "substrings" means in
> >this context.  Do you mean actual string constants?
> >
> No, I mean the strings printed by the generator, e.g. the one from your example
> on how to use a multiline one:
>  pr "\
> #[allow(unused_imports)]
> use std::os::raw::{c_char, c_int, c_uint, c_void};
> use std::os::unix::io::RawFd;
> [...]
> ";

In Python there's are some common utility functions in python/handle.c
and python/utils.c.  The generated code can call those functions.

As for other repeated code I wouldn't worry about it too much.
Another point of the generator is to automate boilerplate, to behave
like an exceptionally precise programmer.  If there's a bug in the
boilerplate there's only one place we have to change.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

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