Displaying 14 results from an estimated 14 matches for "tryfrom".
Did you mean:
try_from
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...ile changed, 311 insertions(+), 150 deletions(-)
diff --git a/generator/rust.ml b/generator/rust.ml
index 79e16dfc6..ee65b1073 100644
--- a/generator/rust.ml
+++ b/generator/rust.ml
@@ -61,14 +61,16 @@ let generate_rust () =
pr "
use std::collections;
use std::convert;
+use std::convert::TryFrom;
use std::ffi;
-use std::slice;
+use std::os::raw::{c_char, c_int, c_void};
use std::ptr;
-use std::os::raw::{c_char, c_int};
+use std::slice;
+use std::str;
#[allow(non_camel_case_types)]
-enum guestfs_h {} // opaque struct
+enum guestfs_h {} // opaque struct
#[link(name = \"guestfs\&...
2019 Jun 27
4
Re: [PATCH 9/9] Rust bindings: Complete bindings
Patch 9 is a kind of dumping ground of all kinds of stuff. It may be
better to spend some time with git rebase -i trying to work this into
more coherent patches.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live
2019 Jul 20
2
Re: [PATCH] Rust bindings: Add Rust bindings
...le `pub(crate)` would make the
> definition
> public but only for this particular crate. That way you can share
> things
> between modules without exposing it to consumers of this crate
>
> >+use std::collections;
> >+use std::convert;
> >+use std::convert::TryFrom;
> >+use std::ffi;
> >+use std::os::raw::{c_char, c_int, c_void};
> >+use std::ptr;
> >+use std::slice;
> >+use std::str;
> >+
> >+#[allow(non_camel_case_types)]
> >+enum guestfs_h {} // opaque struct
> >+
>
> You should not use empty enum...
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
...=
+ if List.exists (fun x -> s = x) black_list then
+ s ^ "_"
+ else
+ s
+
+let generate_rust () =
+ generate_header CStyle LGPLv2plus;
+
+ pr "
+use crate::base::*;
+use crate::utils::*;
+use crate::error::*;
+use std::collections;
+use std::convert;
+use std::convert::TryFrom;
+use std::ffi;
+use std::os::raw::{c_char, c_int, c_void};
+use std::ptr;
+use std::slice;
+
+extern \"C\" {
+ fn free(buf: *const c_void);
+}
+";
+
+ List.iter (
+ fun { s_camel_name = name; s_name = c_name; s_cols = cols } ->
+ pr "\n";
+ pr "pub...
2019 Jul 23
2
Re: [PATCH] Rust bindings: Add Rust bindings
..."_"
> + else
> + s
> +
> +let generate_rust () =
> + generate_header CStyle LGPLv2plus;
> +
> + pr "
> +use crate::base::*;
> +use crate::utils::*;
> +use crate::error::*;
> +use std::collections;
> +use std::convert;
> +use std::convert::TryFrom;
> +use std::ffi;
> +use std::os::raw::{c_char, c_int, c_void};
> +use std::ptr;
> +use std::slice;
> +
> +extern \"C\" {
> + fn free(buf: *const c_void);
> +}
> +";
> +
> + List.iter (
> + fun { s_camel_name = name; s_name = c_name; s_cols...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
...=
+ if List.exists (fun x -> s = x) black_list then
+ s ^ "_"
+ else
+ s
+
+let generate_rust () =
+ generate_header CStyle LGPLv2plus;
+
+ pr "
+use crate::base::*;
+use crate::utils::*;
+use crate::error::*;
+use std::collections;
+use std::convert;
+use std::convert::TryFrom;
+use std::ffi;
+use std::os::raw::{c_char, c_int, c_void};
+use std::ptr;
+use std::slice;
+
+extern \"C\" {
+ fn free(buf: *const c_void);
+}
+";
+
+ List.iter (
+ fun { s_camel_name = name; s_name = c_name; s_cols = cols } ->
+ pr "\n";
+ pr "pub...
2019 Jul 17
2
[PATCH] Rust bindings: Add Rust bindings
...black_list = ["unsafe"]
+
+let translate_bad_symbols s =
+ if List.exists (fun x -> s = x) black_list then
+ s ^ "_"
+ else
+ s
+
+let generate_rust () =
+ generate_header CStyle LGPLv2plus;
+
+ pr "
+use std::collections;
+use std::convert;
+use std::convert::TryFrom;
+use std::ffi;
+use std::os::raw::{c_char, c_int, c_void};
+use std::ptr;
+use std::slice;
+use std::str;
+
+#[allow(non_camel_case_types)]
+enum guestfs_h {} // opaque struct
+
+#[link(name = \"guestfs\")]
+extern \"C\" {
+ fn guestfs_create() -> *mut guestfs_h;
+ fn...
2019 Jul 29
1
Re: [PATCH] Rust bindings: Add Rust bindings
...+ if List.mem s black_list then
+ s ^ "_"
+ else
+ s
+
+let generate_rust () =
+ generate_header ~copywrites:copywrites CStyle LGPLv2plus;
+
+ pr "
+use crate::base::*;
+use crate::utils::*;
+use crate::error::*;
+use std::collections;
+use std::convert;
+use std::convert::TryFrom;
+use std::ffi;
+use std::os::raw::{c_char, c_int, c_void};
+use std::ptr;
+use std::slice;
+
+extern \"C\" {
+ fn free(buf: *const c_void);
+}
+";
+
+ List.iter (
+ fun { s_camel_name = name; s_name = c_name; s_cols = cols } ->
+ pr "\n";
+ pr "pub...
2019 Jun 27
0
[PATCH 9/9] Rust bindings: Complete bindings
...Generate the list of files generated -- last. *)
diff --git a/generator/rust.ml b/generator/rust.ml
index 4766357be..ee65b1073 100644
--- a/generator/rust.ml
+++ b/generator/rust.ml
@@ -61,14 +61,16 @@ let generate_rust () =
pr "
use std::collections;
use std::convert;
+use std::convert::TryFrom;
use std::ffi;
-use std::slice;
-use std::ptr;
use std::os::raw::{c_char, c_int, c_void};
+use std::ptr;
+use std::slice;
+use std::str;
#[allow(non_camel_case_types)]
-enum guestfs_h {} // opaque struct
+enum guestfs_h {} // opaque struct
#[link(name = \"guestfs\")]
extern \&...
2019 Jul 08
2
Re: [PATCH] Add Rust bindings
On Mon, Jul 08, 2019 at 10:04:57AM +0100, Richard W.M. Jones wrote:
>On Mon, Jul 08, 2019 at 10:49:55AM +0200, Martin Kletzander wrote:
>> On Mon, Jul 08, 2019 at 10:10:10AM +0200, Pino Toscano wrote:
>> >On Saturday, 6 July 2019 13:03:24 CEST Martin Kletzander wrote:
>> >>Just one thing, the Cargo.toml includes a version under which the crate would be
>>
2019 Jul 17
0
Re: [PATCH] Rust bindings: Add Rust bindings
...2) you can scope the `pub`, for example `pub(crate)` would make the definition
public but only for this particular crate. That way you can share things
between modules without exposing it to consumers of this crate
>+use std::collections;
>+use std::convert;
>+use std::convert::TryFrom;
>+use std::ffi;
>+use std::os::raw::{c_char, c_int, c_void};
>+use std::ptr;
>+use std::slice;
>+use std::str;
>+
>+#[allow(non_camel_case_types)]
>+enum guestfs_h {} // opaque struct
>+
You should not use empty enums for ffi opaque structs as they can be optimized
out....
2019 Jul 26
4
Re: [PATCH] Rust bindings: Add Rust bindings
Hi Hiroyuki,
sorry for the late reply.
Most of the work is definitely nice! There are few notes below,
although they are not big issues. I will check this patch once more
on monday, especially the rust parts.
Otherwise, I'd say that we are close to merging this :)
On Tuesday, 23 July 2019 10:37:17 CEST Hiroyuki Katsura wrote:
> From: Hiroyuki_Katsura
2019 Jul 02
16
[PATCH] Add Rust bindings
I fixed the patch I submitted before based on comments, and there are some
commits which are merged or divided. So, I will re-send all the patches.
Regards,
Hiroyuki Katsura
2019 Jun 27
16
[PATCH 1/9] Rust bindings: Add Rust bindings
From: Hiroyuki_Katsura <hiroyuki.katsura.0513@gmail.com>
---
Makefile.am | 4 ++++
configure.ac | 3 +++
generator/Makefile.am | 3 +++
generator/bindtests.ml | 3 +++
generator/bindtests.mli | 1 +
generator/main.ml | 5 +++++
generator/rust.ml | 34 ++++++++++++++++++++++++++++++++++
generator/rust.mli | 19 +++++++++++++++++++