Category "rust"

Associated type for ndarray arguments in rust

I want to create an interface for a (numeric) algorithm for which I want to provide an implementation with ndarray and similar libraries (let's say pytorch bind

Clap raw bytes arguments

I would like to use raw byte argument with clap For example --raw $(echo -n -e 'B\x10CC\x01\xff') will give me the following bytes array [66, 16, 67, 67, 1, 239

Rust application using GTK3 compiles without errors but run give error msg

I have a small application that if I do a println!("Hello World"); compiles and runs properly. If I change the source to ... let app = Application::bui

How to transfer SOL in anchor smart contract instruction

I am creating a dapp where multiple users can deposit SOL into an event account, and depending on whoever wins the event, they can redeem SOL back to their wall

Different behaviors between C and Rust code snippets

I have a C code snippet which uses pipe() and fork() to communicate between parent and child process. I want to replicate it in Rust. For the POSIX APIs used in

Syntax highlighting in egui Rust

I'm writing a text editor in Rust using egui. I am trying to implement syntax highlighting, so I followed the example in the demo. It works there, so I thought

Why doesn't rustc infer the type based on std trait implementations?

Consider the following code: use std::net::IpAddr; pub struct Server { host: IpAddr } impl Server { fn new(host: IpAddr) -> Self { Self {ho

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::{Sign

How to replace all '\n' character after 'word' with 'comma' character

Trying to replace all the \n character after the word 'key2:' pattern with comma. Input String: key1:value1\nkey2:value2\nvalue22\nvalue222 Expected: key1:valu

Can macros match against constant arguments instead of literals?

Given the macro matching example, this shows how macros can match an argument. I've made very minor changes here to use numbers: macro_rules! foo { (0 =&g

What is a "projection" and how does it relate to a StreamReader?

I'm receiving RecordBatches serialized as bytes and I'm trying to de-serialize into RecordBatches. Using StreamReader::try_new() and passing in the byte data an

What is the best way to solve multiple definitions introduced by a 3rd party library? [ELF and Mach-O]

Background Imagine the situation: static library libR.a is written rust and it depends on libCXX0.a. Binary X depends on both libR.a and libCXX0.a and it is wri

Linux custom init and SIGTERM

I try to build my own init with rust language. this is my example code : use std::process::Command; fn main() { loop { println!("Welcome to custom

How decompress and unpack tar.gz archive in download process?

I need decompress and unpack big .tar.gz files (e.g. ~5Gb) in download process without save an archive file on disk. I use reqwest crate for downloading files,

how do i make custom file that acts like an secured folder that only my rust app can access, with a password

I'm making an emulated os that uses a browser to render and a abstraction of file system to allow apps to access their folders only. However, since it's an laye

Unable to Setup\Connect to AWS Lightsail TCP Server

I have created a rust tcp server framework. (https://github.com/HasinZaman/SingleThreadServer) The framework works fine without any issue on my local machine; a

cannot find type `Json` in module `content` in rust rocket

Today when I using cargo cargo 1.59.0 (49d8809dc 2022-02-10) compile the rust rustc 1.59.0 (9d1b2106e 2022-02-23) project, shows error: error[E0412]: cannot fin

the trait `anchor_lang::AccountDeserialize` is not implemented for `anchor_spl::token::Mint`

I am trying to CPI the Token Program to send spl-tokens to a wallet. For this the derive accounts in the context struct has three accounts without any attribute

Iterator next method lifetime mismatch

I'm trying to create an Iterator interface using the csv crate such that I can return a HashMap of col-name: value and am running into a lifetime error I cannot

Is there something like Rust's std::option_env in csharp?

In Rust you can inspect environment variables at compile time like so: let sha: Option<&'static str> = option_env!("CI_COMMIT_SHA"); println!("CI_COMM