Questions tagged [rust-crates]

Crates are the unit of compilation in Rust.

Crates are the unit of compilation in , and the basic building block of its system.

The crates can be published in crates.io, the official Rust packages registry, where you can browse them.

206 questions
2
votes
1 answer

What is the Rust equivalent to Intel's tbb::concurrent_queue?

I am looking for an equivalent of the concurrent_queue from Intel's tbb module in Rust. I have found some crates: multiqueue two-lock-queue crossbeam-deque and even futures-pool thread-pool I feel like they are all doing similar things, however…
2
votes
1 answer

Xargo not running in nightly

I am trying to follow some instructions to run my Rust code on a GPU. However, I am unable to get it to compile. Despite me installing Rust nightly, Xargo still claims that Rust nightly is not installed. I tried uninstalling and reinstalling Xargo…
2
votes
3 answers

Is there a way to make clap treat -? the same way as -h?

The clap crate implements built-in behaviour for the -h option, but it doesn't seem to do the same for -?. Is there a way to tell it to do so?
Kağan Kayal
  • 2,303
  • 1
  • 19
  • 30
2
votes
2 answers

How do I add #![feature(***)] to another crate's attributes without forking the crate?

Every time I see an error like: error: associated constants are experimental (see issue #29646) ... = help: add #![feature(associated_consts)] to the crate attributes to enable = note: this error originates in a macro outside of the…
boehm_s
  • 5,254
  • 4
  • 30
  • 44
2
votes
1 answer

Is it possible to have a module which is partially accessible outside of a crate and partially only inside the crate?

Is there any better way than just put everything in the same module? sub_module.rs pub struct GiantStruct { /* */ } impl GiantStruct { // this method needs to be called from outside of the crate. pub fn do_stuff( /* */ ) { /* */…
lncr
  • 826
  • 8
  • 16
2
votes
1 answer

How to skip a dependency if related feature is disabled

Suppose I have a crate which depends on the glob crate only if #[cfg(feature = "glob")] is enabled. Also, this feature is disabled by default. How can I skip downloading and compiling of the glob crate by default? # Cargo.toml ... [features] default…
2
votes
1 answer

Unable to trace type-expectation error in Rust

Repository https://github.com/hunterlester/rusty_arcade Versions Rust: 1.7.0 sdl2: 0.16.1 sdl2_image: 0.16.0 Error src/views/mod.rs:88:13: 93:23 error: mismatched types: expected `core::option::Option`, found…
Hunter Lester
  • 2,972
  • 3
  • 15
  • 19
2
votes
1 answer

"unresolved import" when using an item from a nested module

I have a small program that I've been trying to get working, but I keep getting unresolved import messages. main.rs: mod sub_module; use sub_module::a_structure; fn main() { let x: a_structure = /* init code */; } sub_module.rs: pub mod…
tqoitc
  • 23
  • 4
2
votes
1 answer

Reading then modifying JSON with rustc_serialize

So let's say I want to replace {"foo": 13} with {"foo": 14}. Attempt: extern crate rustc_serialize; use rustc_serialize::json::Json; fn main() { let data = Json::from_str("{\"foo\": 13, \"bar\": \"baz\"}").unwrap(); let mut obj =…
A T
  • 13,008
  • 21
  • 97
  • 158
1
vote
1 answer

Rust confusion about specific package

First steps with Rust. I'm trying to following a fairly simple piece of code here to analyse the contents of .docx files (MS Word files). At the bottom of that page is the supposed completed code (I also added to the "dependencies" section of…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
1
vote
0 answers

How to compile rust crate using `-Zpanic-in-drop=abort`?

Compile Rust crate using -Zpanic-in-drop=abort and build-std options got lots of errors as below: error: the crate `std` is compiled with the panic-in-drop strategy `unwind` which is incompatible with this crate's strategy of `abort` error: the…
Larry
  • 155
  • 7
1
vote
1 answer

Is main() ignored in a crate I publish to crates.io?

I'm interested in publishing my first crate to crates.io. I have two files of code: lib.rs containing a pub struct I want to share with the world, and all kinds of doc comments, and main.rs which has a main() function that is basically a test of…
workerjoe
  • 2,421
  • 1
  • 26
  • 49
1
vote
0 answers

Get Applications List in Windows 10/11 using Rust

I'm trying to get Windows 10 all installed Applications. In Macos I can use system_profiler command to get installed applications and export it to json file then parse it to Rust, does Windows have any similiar command ? Thank in advance
Anji
  • 517
  • 2
  • 10
1
vote
1 answer

Rustdoc Doesn't Recognize Imported Dependencies

I just created a new Rust project and introduced one dependency in main.rs. When I try to run rustdoc src/main.rs, I get the following error: error[E0433]: failed to resolve: maybe a missing crate `rand`? --> src/main.rs:4:5 Even though Cargo.toml…
zarnoevic
  • 329
  • 3
  • 12
1
vote
1 answer

Hitting upload limit on crates.io on a sys crate

I'm trying to publish a sys crate for libvmaf. Unfortunately I can not simply dynamically link to libvmaf because it's not distributed anywhere and I need to build it from source and include it in my library. Unfortunately libvmaf is absolutely huge…
Brandon Piña
  • 614
  • 1
  • 6
  • 20