Category "rust"

Rust WebAssembly inside browser change html canvas size - eframe

I'm simply trying to change the size of the html canvas element generated by webassembly from my rust code. I'm kinda new to rust and wasm and i'm still trying

Rust - Why we don't need borrow A when calling A::func(&self) from A self [closed]

See the code: struct A {} impl A { fn a(&self) {} } pub fn main() { let a = A {}; a.a(); A::a(&a); } Why a.a() does

impl Default sugar for large struct without derive

If I have a struct I need Default implemented on, if all the field's types have Default implemented themsevles, then I can use the derive macro, otherwise I nee

Does Rust narrow lifetimes to satisfy constraints defined on them?

Please consider this example (playground): struct Container<'short, 'long: 'short, T: 'long> { short_prop: &'short u8, long_prop: &'long T

Solang - panicked at 'type not allowed'

I am trying to get an Ethereum smart contract up and running for Solana. I'm using solang and it had a few issues that I was able to fix, like Solidity's assemb

How to unwrap a tuple-like enum variant in Rust?

currently I am working on Image crate. This crate has a enum type called DynamicImage, As shown below: #[non_exhaustive] pub enum DynamicImage { ImageLuma8(

How should I resolve a "ld: library not found for -liconv" error when running "cargo build"?

After installing Rust and Cargo via the following command... curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh I ran cargo build on a tiny "Hello

explicit type annotation in Rust with private type

I want to find out the type of a variable in Rust: use anyhow::Result; use arti_client::{TorClient, TorClientConfig}; extern crate tokio; #[tokio::main] async

Program, Account, Publickey and Keypair in Anchor

I'm beginner of solana programming using anchor. Now I have no clear understanding about these items. **Program, Account, PublicKey, Keypair** Appreciate any

Why does reading from an exited PTY process return "Input/output error" in Rust?

I'm attempting to read from a process that's backed by a PTY in Rust, but once all bytes have been read from the process then reading from the process returns a

How to pass out parameter to function from Swift FFI?

Let's say I have a function defined in Rust, which looks like this: #[no_mangle] pub unsafe extern "C" fn do_something( my_value: *mut MyStruct, some_pa

How can I return a shared channel or data stream that can be consumed by multiple receivers?

my goal/use case: Subscribe to a datafeed Publish to internal subscribers Example use case: subscribe to stock prices, consume from multiple different bots runn

How to borrow ctx in a module chain

I have this entrypoint where ctx is passed by a parent: pub mod instructions; #[program] pub mod solana_anchor_coinflip { use super::*; pub fn flip(ct

What is the lldb equivalent for gdb load

I am trying to flash a binary to the STM32F303 MCU, the equivalent gdb command is "load", what is the equivalent command for lldb?

`#[derive(Clone)]` seems to wrongfully enforce generic to be `clone`

It seems that when deriving Clone, Rust forwards the Clone trait requirement to Generics that do not require the trait, like if they are wrapped inside an Arc.

Unresolved Imports - "help: a similar path exists"

I'm fairly new to Rust and am trying to set up a new project. I'd like to have code for a parser, tokens, and addressing for a little 6502 project in separate f

How do I use a channel receiver inside a nested closure?

I want to share some data between an async function with another async function running on a separate thread. In this case it's a cronjob. This is the solution

Deploying Solana Metaplex contracts for further extending

Helloy guys, does smb know, how to deploy metaplex smart-contracts separately from this repo??? Did smb tried it? https://github.com/metaplex-foundation/metaple

Error adding Custom RPCs for custom pallet Substrate

I've been working with parity's contracts node (latest version) and the substrate template node (tag polkadot-v0.9.18), both present the same issue when compili

Os permission error when trying to create a `tun` device

I'm trying to create a tun device with rust's tun_tap create, I'm following documentation and trying to create an interface with the tun_tap::Iface::new(..);, b