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
0
votes
0 answers

How to use my library from different project in rust

I have 2 projects: First: my_project |__scr | |__main.rs |__Cargo.toml |__Cargo.lock Second (the library (was created by cargo new my_project_library --lib) I plan to use it for many projects): my_project_library |__scr | …
0
votes
1 answer

Where can a dependency be specified if not in Cargo.toml?

I'm looking at the ring crate. In its Dependencies tab I see there is a dependency to the web-sys crate. But in ring's Cargo.toml I don't see web-sys mentioned anywhere. So where does that dependency come from?
at54321
  • 8,726
  • 26
  • 46
0
votes
1 answer

How to publish a workspace crate with a submodule dependency?

I have a project that consist in two crates in a workspace, one of them crate-sys generates some bindings. The other, crate consumes that crate-sys and builds a proper rust API on top of it. On the toplevel git project (workspace), I have configured…
Netwave
  • 40,134
  • 6
  • 50
  • 93
0
votes
1 answer

How to install rust crate?

Basically I want to install a different version of a crate that I found in GitHub, currently unregistered, I'm really new to Rust so maybe there is something that I'm missing. I've already read and that didn't work. The instructions says that to…
felipe
  • 35
  • 5
0
votes
0 answers

Rust-GSL Crate not linking to Rust project

I am trying to use GSL in Rust https://docs.rs/GSL/6.0.0/rgsl/ but am having trouble as I am very new to Rust. Every other crate I have tried to use just works by including the dependency in the Cargo.toml file. However, it doesn't seem to be this…
Teddy_Tort
  • 87
  • 2
  • 10
0
votes
0 answers

How to get Rust OpenGraph crate image URL output

Using "OpenGraph" crate. For my project all I need is URL of the image scraped from the required website, the documentation seems to imply you can just get the image part but the function for the image doesn't take in a URL to scrape from or the…
0
votes
0 answers

rand dependency isn't being recognised even though it has been added to the Cargo.toml dependencies

I'm just getting started in rust and I want to use the rand dependency, so I added it using cargo add rand to the Cargo.toml file used by the project. Here is the code (at the moment a short algorithm to generate a random array of any size): use…
kokis
  • 1
  • 1
0
votes
0 answers

Is it possible to link a static library to a C library and not link the binary against the C library

I am currently writing a program in Rust that requires me to tap into system APIs that are not Rust native. In my case I have a static native library that is written in Swift using the C ABI for linking. I am able to link the Swift library into my…
0
votes
0 answers

Not able to use parts of crate

i'm new to rust and currently trying to use bluer 0.15.0 in a new project i'm working on. I work exactly according to the documentation of bluer but still I am not able to use parts of the crate as it is given in the documentation. This is the code…
Dome
  • 7
  • 5
0
votes
1 answer

How to make a hashset of enum values in Rust

I want to get an ability to create hashset of an enum. As I understand, all I need to do, is to implement PartialEq, Eq and Hash traits for my enums. But the problem is that the enum is declared in some other crate. And because of that implemenation…
Yoskutik
  • 1,859
  • 2
  • 17
  • 43
0
votes
1 answer

Use rsa-pss algorithm to sign data

I want to use RSA-PSS algorithm to sign and verify data by using rust openssl crate. But I ran into some problems. Here is my code: use openssl::sign::{Signer, Verifier, RsaPssSaltlen}; use openssl::rsa::Rsa; use openssl::pkey::PKey; …
Shiqi
  • 837
  • 1
  • 10
  • 18
0
votes
1 answer

Rust can't resolve import from crate root but module is there with child modules available

I am trying to create a basic crud app with actix and diesel but there is a problem with diesel. This is the folder structure of project: |─ migrations |─ src | ├─ users | ├─mod.rs | ├─models.rs |─ main.rs |─ schema.rs where schema.rs is created…
0
votes
0 answers

found staticlib `std` instead of rlib or dylib

found staticlib std instead of rlib or dylib help: please recompile that crate using --crate-type lib note: the following crate versions were found: crate std:…
0
votes
1 answer

Lifetime error in rust when use show-image crate

Can anyone tell what the lifetime error is in the following code? (simplified from my actual code) I've looked it over myself, but I can't figure out what is wrong or how to fix it. use crate::hello_world_capnp::hello_world; use…
0
votes
2 answers

is it possible to make cargo install installing dependent cdylib dlls

I'm on windows and have a Rust cdylib [package] name = "test1dll" [lib] crate-type = ["cdylib"] and a Rust binary which depends on that dll [package] name = "test1" [dependencies] test1dll = { path = "..." } and am looking for a way to make cargo…
ridilculous
  • 624
  • 3
  • 16