Category "rust"

Why does `Fn() -> T` constrain `T` but `Fn(T) -> T` does not

The following code compiles fine: struct StructA<F>(F); impl<F, T> StructA<F> where F: Fn() -> T {} Although T doesn't show up in StructA'

error[E0412]: cannot find type `ProgramResult` in this scope

use anchor_lang::prelude::*; declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); #[program] pub mod myepicproject { use super::*; pub fn start_st

How to call a mvsc dll (C++ or Rust) from Progress Open Edge

I have a dll that i want to call from Progress code but I can't complete. I have tried with Visual Studio 2022, Windows C++ Dll and Rust Dll. Windows C++, Visua

How to use a generic session with Actix and Paperclip?

I've created a server using Actix Web which has authentication support. Now I want to add an OpenAPI Specification using paperclip. Normally you only have to ad

Rust Tcpstream: reading http request sometimes lose the body

I am learning how to write a http server using tcpstream with rust. I use this function to read stream buffer. fn handle_connection(mut stream: TcpStream) {

How do I get past the following GTK4 build errors in Rust

I have downloaded the GTK4 demo from Github and placed it in a directory. I have opened it in VC and attempt to run the demo according to the Read.ME. I get t

Is there an idiomatic way to have a generic over T, &T, Box<T>, Arc<T>, and so forth, where T implements some trait R?

Let's say you have a structure that you want to be a generic over time type T, so long as that type implements some trait R. That's pretty trivial: trait R {

Lifetime of structure's object is shorter than lifetime of structure's member

I have some trouble to correctly understand lifetime concept in Rust. Especially in reference to structure's object itself and structure's member. Following min

How to implement !Send or !Sync for a type?

Is it possible to explicitly mark a type with unimplemented Send or Sync marker traits without some redundant fields? This can be an alternative: struct T {

LLDB prints `i8` as "signed char"

I'm using the LLDB extension for VSCode, and my variables typed as i8 are printed as characters. Both in the VSCode debugging panel, and when using print in the

Trouble implementing custom IntoIterator trait

I'm new to rust, so forgive me if the question is naive. I'm trying to build an OS in rust and I'm following this tutorial. The OS doesn't have memory managemen

Mixing anyhow::Result with std::io::Result

Can anyone help me understand why this code compiles fine: use actix_web::{App, HttpServer}; use anyhow::Result; mod error; #[actix_rt::main] async fn main()

How to compose warp log?

I am pretty new in Rust and trying to build a web application with https://docs.rs/warp/0.2.3/warp/index.html. I have tried: #[tokio::main] async fn main()

Why does my string not match when reading user input from stdin?

I'm trying to get user input and check if the user put in "y" or "n". Surprisingly, in the below code, neither the if nor the if else case executes! Apparently,

Rust thrussh library client example fails at channel_open_session

In thrussh's documentation they have server and client example code. Code based on the example server code has been working fine in various projects. However,

How do I print a backtrace without panicking using thiserror?

I am running a Rust warp webserver and I need more descriptive error messages. I'd like to print a backtrace or something similar so I can tell where the error

Why is rust-analyzer not finding dependencies in workspace member?

I have a cargo workspace with one library "./raytracing" and one binary "./cli". The two workspace members have different dependencies. ./raytracing/Cargo.toml:

Debugging Rust on Vscode : u8 not shown correctly

I am debugging this simple Rust program on Vscode fn main() { let u8: u8 = 3; let b: u16 = 5; let c: u32 = 7; let d: u64 = 9; } The values of t

Building rust with LLVM Fork

Following the instructions here, I have tried building rust with a fork of LLVM which has a back-end for a new target. I have: Recursively cloned the Rust repos

Airdropping Solana to a Specific Account

I would like to airdrop sols into a specific account to get my smart contract to fire an anchor test. Whenever I run my test I come across the error Error: Acco