Category "rust"

How to get a release build with debugging information when using cargo?

The following command $ cargo build produces a non-optimized build with debugging information. On the contrary, $ cargo build --release produces an optimi

Glob Multiple File Types

I want to find files for some pattern with multiple extensions. Ex:- some/path/**.{json,jsonc} But rust glob function is not working with these types of patt

How do I print colored text to the terminal in Rust?

How do I output colored text to the terminal using Rust? I've tried using the special escape characters that I found in this python answer, but they just print

Is there a command to update Cargo to the latest official release?

I seem to have diverging versions of rustc and cargo (I think), $ rustc -V rustc 1.9.0 (e4e8b6668 2016-05-18) $ cargo -V cargo 0.10.0-nightly (10ddd7d 2016-04

Convert two types into a single type with Serde

I'm writing for a program that hooks into a web service which sends back JSON. When a certain property isn't there it provides a empty object, with all its fie

How do you find the local timezone offset in rust

Rust's chrono::Local contains the local timezone information but does not seem to have any methods to get the value as a string or a number of seconds offset.

How to collect multiple results from concurrently working for loop?

I would like to run a function with lots of different variables Let assume my function is : async fn do_the_hard_job(my_input: u16) { ... // do the hard

Is there a way to seed a cryptographically secure RNG engine in rust using a [u8; 64] array?

ORIGINAL QUESTION: I am currently trying to write a library in rust - to be compiled to WASM - for converting a bip39 mnemonic passphrase into an Arweave JWK. I

Local crate in Rust

I am currently learning Rust, and for that purpose I wanted to create my own crate and use it. However, Rust can't find this crate. I have the following file st

How to return an iterator from a function and use it?

I'm trying to teach myself Rust by working on a little calendar project. Here I'm trying to generate a list of dates spanning three whole months around a given

When to use Rc vs Box?

I have the following code which uses both Rc and Box; what is the difference between those? Which one is better? use std::rc::Rc; fn main() { let a = Box::

ld: Invalid value (Producer: 'LLVM13.0.0-rust-1.57.0-nightly' Reader: 'LLVM APPLE_1_1300.0.29.3_0') for architecture arm64

Trying to install and work with zkgroup. Build, run for specific iOS device working fine. But generic archiving is not working. Error text: ld: Invalid value (P

Ambiguous name when using three_d and egui

recently I am using three_d this crate in my project, but when I use three_d and egui in the same script it causes an ambiguous name error use three_d::*; use e

Adding Pallet-staking to frontier unresolved import `sc_rpc::Metadata`

I have used frontier-node-template from parity tech repo to setup a private evm supported network. The network is running fine, authoring blocks and connecting

Why Rust prevents from multiple mutable references?

Like in the topic, why Rust prevents from multiple mutable references? I have read chapter in rust-book, and I understand that when we have multi-threaded code

What is the difference between iter and into_iter?

I am doing the Rust by Example tutorial which has this code snippet: // Vec example let vec1 = vec![1, 2, 3]; let vec2 = vec![4, 5, 6]; // `iter()` for vecs y

How do I authenticate (bind) to ldaps using username and password with the ldap3 crate?

I am searching for a way to supply the username and password while connecting to ldaps. The examples on the documentation page for crate ldap3 seem not illustra

How to compose two calls to Regex::replace_all?

Regex::replace_all has the signature fn (text: &str) -> Cow<str>. How would two calls to this be written, f(g(x)), giving the same signature? Here'

windows-rs GetNamedSecurityInfoW error 87

I'm trying to use windows-rs to use GetNamedSecurityInfoW microsoft api docs to read file permission information, but I keep getting error code 87 corresponds t

Compare enums only by variant, not value

I have an enum with the following structure: enum Expression { Add(Add), Mul(Mul), Var(Var), Coeff(Coeff) } where the 'members' of each varia