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
1 answer

Using a crate errors with "linking with cc failed", while building its source project succeeds

I'm trying to import an external crate in a simple hello world application. In the main.rs, it was wrote use rustdds::*; fn main() { println!("Hello, world!"); } cargo build then errors with user@xxx:~/Documents/dds_test:$ cargo build …
xc wang
  • 318
  • 1
  • 3
  • 14
0
votes
3 answers

Where are release notes of Rust crates published

Is there a standard place where one can see what's new/fixed in a certain crate release? I couldn't find such a section in crates.io or docs.rs.
at54321
  • 8,726
  • 26
  • 46
0
votes
1 answer

Can't use struct after its partially moved by closure

I'm trying to code a wrapper struct around the creation of an event_loop and a graphical context: struct GraphicalContext { pub el: crow::glutin::event_loop::EventLoop<()>, pub ctx: crow::Context } impl GraphicalContext { pub fn new(wb:…
SandWood Jones
  • 104
  • 1
  • 9
0
votes
0 answers

Can't find crate for `rustc_driver`

I tried to build the following rust file, and get an error. src/main.rs: #![feature(rustc_private)] extern crate rustc_driver; fn main() { let value = Some(42); //... } cargo.toml: [package] name = "cargo_test" version = "0.1.0" authors =…
Jw C
  • 171
  • 2
  • 6
0
votes
1 answer

Import rust package with alias in toml

I'm trying to make a simple program checking execution times on two different branches of the same rust project. I wanted to have my .toml look something like this [dependencies] cron_original = { git = "https://github.com/zslayton/cron" } cron_fork…
Typhaon
  • 828
  • 8
  • 27
0
votes
1 answer

How can a submodule import a trait from the root in lib.rs?

I have a src/lib.rs that contains: pub trait Compile { fn from_source(src: &src) { parser::parse(src); } } And a src/compiler/interpreter.rs use crate::Compile; // ERROR HERE - No Compile in the root pub struct Interpreter; impl…
AJ D
  • 52
  • 1
  • 6
0
votes
0 answers

How to import diesel models and schema?

I'm trying to create a small demo app using the diesel crate. I tried the things below by looking at the diesel getting started guide. I don't understand how to import my models and schema and get my query working in main. Attached the snapshot…
Glenn singh
  • 233
  • 1
  • 6
  • 18
0
votes
1 answer

How to pass custom data to macros of log crate in Rust?

Is it possible to do something like this in macros of the log crate? enum ErrorKind { KindA, KindB, KindC, } error!(ErrorKind::KindA, "Unable to do A."); In the log function of the custom logger: fn log(&self, record: &Record) { if…
0
votes
1 answer

Feature to toggle dependent crate features

I'm a bit new to Rust and ran into an issue where I'd like to make a feature of my crate that designates which features of a dependent crate should be included. More specifically, I'm using the image-rs crate, which defines features for which image…
catleeball
  • 781
  • 7
  • 16
0
votes
1 answer

How to import a file in a folder into a file in another folder in rust?

src I -- handlers I--- authhandler.rs models I--- account.rs I--- mod.rs authhandler: pub fn register(register: web::Json) -> impl Responder { ......... } account: pub struct RegisterRequest { …
codeme
  • 861
  • 2
  • 12
  • 29
0
votes
0 answers

crate - failure. Using #[derive(Fail)] with non 'static lifetime

I have a struct with a non 'static lifetime, this sruct is then used by enum that represents my error: #[derive(Debug, Fail)] pub enum ParserError<'a> { #[fail(display = "Unexpected [{}] got {}", _1, _0)] ExpectedAGotB(Token<'a>,…
anvlkv
  • 147
  • 2
  • 11
0
votes
0 answers

How to specify crates to rustc in command-line?

I'm trying to use rand::random function in Rust: use rand::random; fn main(){ println!("{}",rand::random::()); } It didn't work, the rand crate was not installed by default. So I installed it: $ cargo install rand However, after installing…
Dee
  • 7,455
  • 6
  • 36
  • 70
0
votes
1 answer

How to deal with a crate being marked as containing a Trojan?

I added one dependency to my project which added another and another - in the end, I got the crate pelite. This crate has a "blob" file which was marked by Windows as "Trojan:Win32/Fuery.B!cl" I assumed that this was a false positive, but it wasn't…
0
votes
0 answers

How can I export just the functions of a module as part of another module?

I want to organize some functions into multiple files since they're big enough to warrant that but from outside of that directory I want them all to appear to be exported from same parent module. I have the…
justin.m.chase
  • 13,061
  • 8
  • 52
  • 100
0
votes
1 answer

I am trying to get data over an OpenWeather API in Rust but I am facing some iusse regarding parsing I guess

extern crate openweather; use openweather::LocationSpecifier; static API_KEY: &str = "e85e0a3142231dab28a2611888e48f22"; fn main() { let loc = LocationSpecifier::Coordinates { lat: 24.87, lon: 67.03, }; let weather =…
Areeb Sid
  • 13
  • 2