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 purpose of rustc-std-workspace-core crate?

Looking at some crates in https://crates.io/ I found that rand is the most downloaded crate and looking in it's dependencies I found the libc crate and in it's dependencies I found the rustc-std-workspace-core which has 0 dependencies with this…
Michael Pacheco
  • 948
  • 1
  • 17
  • 25
2
votes
2 answers

Local crate not found when trying to update edition via cargo fix

Context: I have a local C library called 'libmaths' that then uses Bindgen to create a 'libmaths-sys' crate that is locally stored in the same directory as my project. Issue: I want to use some of the features in the 2021 edition of Rust and…
Jambalaya
  • 31
  • 4
2
votes
1 answer

Passing Rust vector to C++ function using cpp crate

I am using the cpp crate (https://crates.io/crates/cpp) to run some C++ code from inside Rust. How can I make a vector, that is known to the Rust code available inside the C++ code? First I tried something like this: cpp::cpp!{{ #include…
CrustyPeanut
  • 69
  • 2
  • 6
2
votes
1 answer

converting rust image to rgb-pixel-array and using it as OpenGL texture

I am writing an openGl wrapper in rust for educational purposes. However, I have a problem loading textures from an image file (jpg). I am loading the image using the image crate and converting it to a ImageBuffer. The loading part is working,…
Addi873
  • 85
  • 5
2
votes
1 answer

How do I convert a custom image implementation of a bitmap slice to PNG?

I work at a project written in Rust that basically mocks a printer. I get printer input, and try to convert it to human readable data (strings, images). So, for reproducing the QR code, I am converting the printer input to BitMap Slices (I created a…
2
votes
0 answers

An easy way to see all (sub)dependencies of a Rust crate (online)?

On crates.io we can easily see the direct dependencies of a crate by just clicking on the Dependencies tab. Is there a way to also easily see the sub-dependencies of a crate? Perhaps in a tree-like view, similar to what cargo tree would display. Or…
at54321
  • 8,726
  • 26
  • 46
2
votes
1 answer

Rust: problem using ndarray-linalg & ndarray crates

I am writing a cross compiled library in Rust (that will work on IOS/Android/Linux/MacOS). I am using ndarray to implement the algorithms. I need to calculate the norm of an ArrayBase. I found ndarray-linalg which is a crate that implements lots of…
2
votes
1 answer

How to get the interrupt reexport from cortex-m-rt in stm32f30x to run

I want to write a program for the STM32F3Discovery board using rust and the cortex-m-rt and stm32f30x crates. More precisely I want to implement an external interrupt for which I want to use the #[interrupt] attribute. But there seems to be a…
MEisebitt
  • 122
  • 7
2
votes
1 answer

How can I create a custom filter type using log4rs?

The only available filter is a level threshold, but say I wanted to filter by a specific target: $expr instead. How would I programmatically (or in the yml file) let log4rs know that I need a different kind of filter? Would I need to add a custom…
z.karl
  • 295
  • 2
  • 12
2
votes
1 answer

How do I build a project that uses the device_query crate on WSL?

I’m trying to track which keys are typed in WSL using the device_query crate. I’ve read the crate’s documentation, added device_query = "0.2.4" to my Cargo.toml file and installed the X11 dependency (sudo apt install libx11-dev). In my src/main.rs…
Okano
  • 232
  • 2
  • 9
2
votes
1 answer

The code reference in `crates.io` does not match with the actual crate

I'm very new to rust's syntax of using libraries. Well, mostly new to rust overall. I've included a library, that is unfinished, and seemingly doesn't work. The library is called "hours", the lib.rs contains the following: // #[derive(Clone, Debug,…
berkes
  • 26,996
  • 27
  • 115
  • 206
2
votes
1 answer

How to include a text file along with a crate installation

My program works as expected with my local machine. It prints random lines from a text file in the vein of the Emacs "Spook" amusement (M-x spook). The text file is located in src/spook.lines. C:\Users\datan>spooks domestic Eiffel Tower Euzkadi Ta…
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
2
votes
2 answers

Is it possible to specify version for feature in dependency in Cargo.toml?

For example, I use barcoders crate: barcoders = {version = "0.10.0", features = ["image",]} Is it possible to specify which version of image this dependency should use? Something like barcoders = {version = "0.10.0", features =…
Nikolai Golub
  • 3,327
  • 4
  • 31
  • 61
2
votes
0 answers

rust holochain diorama testing fails because of a function that uses chrono crate

I'm running on Mac OS V10.14.6 and running v0.0.21-alpha1 on nixOS. So, I've been trying to make a create_user_entry zome function and it takes User struct(with nested UserInfo struct). All my unit tests in rust are passing but then the diorama test…
2
votes
0 answers

Confused about extern crate

So I'm currently learning the Rust language on the official website and I'm in the middle of Chapter 12 where they want me to split some of my code from src/main.rs to src/lib.rs. At first I created a library crate named "minigrep" inside the binary…
toobie
  • 41
  • 2