Displaying 20 results from an estimated 213 matches for "crate".
Did you mean:
create
2024 Jun 18
1
[PATCH v2 1/8] rust: drm: ioctl: Add DRM ioctl abstraction
...44
index 000000000000..09ca7a8e7583
--- /dev/null
+++ b/rust/kernel/drm/ioctl.rs
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+#![allow(non_snake_case)]
+
+//! DRM IOCTL definitions.
+//!
+//! C header: [`include/linux/drm/drm_ioctl.h`](srctree/include/linux/drm/drm_ioctl.h)
+
+use crate::ioctl;
+
+const BASE: u32 = uapi::DRM_IOCTL_BASE as u32;
+
+/// Construct a DRM ioctl number with no argument.
+#[inline(always)]
+pub const fn IO(nr: u32) -> u32 {
+ ioctl::_IO(BASE, nr)
+}
+
+/// Construct a DRM ioctl number with a read-only argument.
+#[inline(always)]
+pub const fn IOR&l...
2019 Aug 11
0
[PATCH 2/2] Rust bindings: Make it able to publish this crate
I added
- data required to publish this crate to `crates.io`.
- README.md which contains the details of how to publish this crate.
---
rust/Cargo.toml.in | 5 ++++-
rust/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 rust/README.md
diff --git a/rust/Cargo.t...
2007 Nov 13
4
has_and_belongs_to_many between the same model
Hi! I have two models: Jewel and Crate. A crate can contain other crates
and it can also contain as many jewels as we want. So, in jewel.rb i
put:
[code]
belongs_to :crate
[/code]
and in crate.rb:
[code]
has_many :jewels
has_and_belongs_to_many :crates
[/code]
Now i have to create the join table "crates_crates" but i rea...
2019 Aug 11
5
[PATCH 1/2] Rust bindings: Add long description
`cargo doc` will generate docs with long descriptions.
I did not add the settings of outputting these docs to `/website`.
This is because
- by publishing this crate to crates.io, users can see the docs in
`docs.rs` like `https://docs.rs/guestfs/<version>/guestfs/`. It is easy
to hold multiple documents corresponding to each version.
- the style of the documents generated by `cargo doc` is far different
from the documents which already exist.
---
gen...
2019 Jul 08
2
Re: [PATCH] Add Rust bindings
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
>> published. I presume the version would be the same as the one of the project
>> itself, i.e. when releasing libguestfs-x.y.z, we publish guestfs-rs-x.y.z to
>> crates.io.
>
>Speaking of naming: it seems like libraries that interface/wrap a
>foreign C/C++/etc...
2019 Aug 05
1
Re: [PATCH 1/2] Rust bindings: Add Event structs, Clarify Handle lifetime
...t;'a> change is needed because
<insert here what you already wrote as commit message>.
> diff --git a/rust/src/base.rs b/rust/src/base.rs
> index 02ad33535..c17607cb3 100644
> --- a/rust/src/base.rs
> +++ b/rust/src/base.rs
> @@ -17,6 +17,9 @@
> */
>
> use crate::error;
> +use crate::event;
> +use crate::guestfs;
guestfs.rs has:
use crate::base::*;
So it means rust allows cyclic uses of modules/crates?
> diff --git a/rust/src/event.rs b/rust/src/event.rs
> new file mode 100644
> index 000000000..c363e913a
> --- /dev/null
> +++ b/rus...
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
...+ *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301 USA.
> > + */
> > +
> > +extern crate guestfs;
> > +
> > +use std::sync::{Arc, Mutex};
> > +
> > +#[test]
> > +fn close_event() {
> > + let close_invoked = Arc::new(Mutex::new(0));
>
> Maybe a thread-safe Arc is not needed for this test -- it's just a
> single-threaded test with just...
2019 Aug 05
0
[PATCH 1/2] Rust bindings: Add Event structs, Clarify Handle lifetime
...;;
List.iter (
fun ({ name = name; shortdesc = shortdesc; longdesc = longdesc;
style = (ret, args, optargs) } as f) ->
diff --git a/rust/src/base.rs b/rust/src/base.rs
index 02ad33535..c17607cb3 100644
--- a/rust/src/base.rs
+++ b/rust/src/base.rs
@@ -17,6 +17,9 @@
*/
use crate::error;
+use crate::event;
+use crate::guestfs;
+use std::collections;
#[allow(non_camel_case_types)]
#[repr(C)]
@@ -34,31 +37,37 @@ extern "C" {
const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1;
const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2;
-pub struct Handle {
+pub struct Handle&l...
2019 Jul 06
3
Re: [PATCH] Add Rust bindings
...d not added to .gitignore.
>>
>> I'm sorry I forgot adding Cargo.lock to .gitignore. I'll add it to
>> .gitignore. However, I think Cargo.toml should be staged. This is because
>> this is a file managed by hands. It contains dependencies, versions,
>> editions, crate name. It can be generated by shellscript which dumps such
>> information. However, I think it may be not preferable.
>
>OK, no problem.
>
Just one thing, the Cargo.toml includes a version under which the crate would be
published. I presume the version would be the same as the one o...
2019 Aug 06
2
Versioning of rust bindings
In the last patch, I let the version of Rust bindings be the same as the
version of libguestfs. However, I came to think it is not preferable in
terms of the custom of Rust crate versioning.
After a version of a crate is published to crates.io, no one can republish
the crate with the same version. This means that when there are some
mistakes in the rust bindings, after they are fixed, it is required to add
the version to publish it. I'm not sure about the versioning of...
2020 Oct 31
0
Re: [libguestfs/nbdkit] Publish Rust bindings to crates.io (#4)
On Fri, Oct 30, 2020 at 03:47:36PM -0700, Alan Somers wrote:
> https://crates.io/crates/nbdkit/
>
This is great stuff, thanks for doing all this hard work.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://li...
2024 Jun 18
1
[PATCH v2 3/8] rust: drm: add driver abstractions
...st/kernel/drm/drv.rs
new file mode 100644
index 000000000000..cd594a32f9e4
--- /dev/null
+++ b/rust/kernel/drm/drv.rs
@@ -0,0 +1,141 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+
+//! DRM driver core.
+//!
+//! C header: [`include/linux/drm/drm_drv.h`](srctree/include/linux/drm/drm_drv.h)
+
+use crate::{bindings, drm, private::Sealed, str::CStr, types::ForeignOwnable};
+use macros::vtable;
+
+/// Driver use the GEM memory manager. This should be set for all modern drivers.
+pub const FEAT_GEM: u32 = bindings::drm_driver_feature_DRIVER_GEM;
+/// Driver supports mode setting interfaces (KMS).
+pub...
2019 Jul 30
4
[PATCH] Rust bindings: Implement Event features
...;
List.iter (
fun ({ name = name; shortdesc = shortdesc; longdesc = longdesc;
style = (ret, args, optargs) } as f) ->
diff --git a/rust/src/base.rs b/rust/src/base.rs
index 02ad33535..0c6a3bdba 100644
--- a/rust/src/base.rs
+++ b/rust/src/base.rs
@@ -17,6 +17,10 @@
*/
use crate::error;
+use crate::event;
+use crate::guestfs;
+use std::collections;
+use std::sync;
#[allow(non_camel_case_types)]
#[repr(C)]
@@ -34,31 +38,37 @@ extern "C" {
const GUESTFS_CREATE_NO_ENVIRONMENT: i64 = 1;
const GUESTFS_CREATE_NO_CLOSE_ON_EXIT: i64 = 2;
-pub struct Handle {
+pub...
2024 Sep 02
2
[PATCH v2 3/8] rust: drm: add driver abstractions
...0000000000..cd594a32f9e4
> --- /dev/null
> +++ b/rust/kernel/drm/drv.rs
> @@ -0,0 +1,141 @@
> +// SPDX-License-Identifier: GPL-2.0 OR MIT
> +
> +//! DRM driver core.
> +//!
> +//! C header: [`include/linux/drm/drm_drv.h`](srctree/include/linux/drm/drm_drv.h)
> +
> +use crate::{bindings, drm, private::Sealed, str::CStr, types::ForeignOwnable};
> +use macros::vtable;
> +
> +/// Driver use the GEM memory manager. This should be set for all modern drivers.
> +pub const FEAT_GEM: u32 = bindings::drm_driver_feature_DRIVER_GEM;
> +/// Driver supports mode setti...
2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
...s_messages.rs
diff --git a/rust/src/bin/.gitkeep b/rust/src/bin/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/rust/src/bin/event.rs b/rust/src/bin/event.rs
new file mode 100644
index 000000000..3a3aa7d7c
--- /dev/null
+++ b/rust/src/bin/event.rs
@@ -0,0 +1,29 @@
+extern crate guestfs;
+use guestfs::*;
+
+fn main() {
+ for _ in 0..256 {
+ let mut g = match Handle::create() {
+ Ok(g) => g,
+ Err(e) => panic!(format!(" could not create handle {:?}", e)),
+ };
+ g.set_event_callback(
+ |e, _, _, _| mat...
2020 Jun 11
3
New Rust bindings for nbdkit
The existing Rust bindings for nbdkit aren't very idiomatic Rust, and they
are missing a lot of features. So I've rewritten them. The new bindings
aren't backwards compatible, but I doubt that's a problem. Most likely,
nobody has tried to use them yet, since the crate hasn't even published to
crates.io. Please review the attached patch.
-Alan
2019 Jul 17
0
Re: [PATCH] Add Rust bindings
...19 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
> >> >>published. I presume the version would be the same as the one of the
> project
> >> >>itself, i.e. when releasing libguestfs-x.y.z, we publish
> guestfs-rs-x.y.z to
> >> >>crates.io.
> >> >
> >> >Speaking of...
2020 Sep 01
2
Rust bindings to nmath
...for a project I was working on in
Rust, and I've used the R math library as a standalone solution. I
thought the R developers would be interested in the fact that their work
is being used elsewhere, and I also wanted to say thanks for some code I
do NOT want to have to write myself!
The "crate" (Rust's name for a package) is at
https://lib.rs/crates/r_stats.
Best wishes
Richard Dodd
2020 Jun 15
3
Re: New Rust bindings for nbdkit
...Rust bindings for nbdkit aren't very idiomatic Rust, and they
> > are missing a lot of features. So I've rewritten them. The new bindings
> > aren't backwards compatible, but I doubt that's a problem. Most likely,
> > nobody has tried to use them yet, since the crate hasn't even published to
> > crates.io. Please review the attached patch.
> > -Alan
> Other issues:
>
> * The license removed this clause:
>
> -// * Neither the name of Red Hat nor the names of its contributors may be
> -// used to endorse or promote pro...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
...ts.ml b/generator/bindtests.ml
index 58d7897b3..7f99fcdae 100644
--- a/generator/bindtests.ml
+++ b/generator/bindtests.ml
@@ -983,6 +983,72 @@ and generate_php_bindtests () =
dump "bindtests"
+and generate_rust_bindtests () =
+ generate_header CStyle GPLv2plus;
+
+ pr "extern crate guestfs;\n";
+ pr "use guestfs::*;\n";
+ pr "use std::default::Default;\n";
+ pr "\n";
+ pr "fn main() {\n";
+ pr " let g = match Handle::create() {\n";
+ pr " Ok(g) => g,\n";
+ pr " Err(e) => panic!...