Category "rust"

Tauri: display webview + svelte overlay or webview all the way with webhooks?

In my desktop app, I want to display a website using tauri. I also want my app to communicate with a local webserver. With tauri, I need to have wry host the we

Anchor build error versions of anchor-spl and anchor-lang

I'm using the following repository of rust: https://github.com/SmartCodeBlockchainDev/Nelson-NFT-stacking when I try to do an anchor build I get the following e

How to use the mold linker with cargo?

I'm using lld as my linker currently for Rust, but recently encountered the mold project, which is faster than lld. I'd like to try it for Rust compilation, but

Getting a windows-rs HWND from winit?

I'm fairly new to Rust and am trying to get the following to work: let hwnd : *mut HWND = window.hwnd().cast(); let swapchain = unsafe { factory.CreateSwapCha

How to parse a function with a declarative macro?

I need a declarative macro to parse a function. I wrote one: macro_rules! parse_fn { () => {}; ( $( #[ $Meta : meta ] )* $( pub )? fn $Name

How can I fix the error E0277: the trait bound `[usize]: std::marker::Sized` is not satisfied?

I'm trying to pass an array to a function: fn my_func(xs: [usize]) -> usize { 0 } fn main() { let arr = [329, 457, 657]; let res = my_func(inp)

What happens when you clone a `&str`?

What happens when you clone a &str? Is the cloned &str pointing to the same place as clonee &str or is it something? Is this documented anywhere?

Lifetime of a reference passed to async callback

I have async function to which I am passing async callback. The callback takes a reference as a parameter. use core::future::Future; async fn foo(bar: &u32

Lifetime sub-typing and impl-trait

I bumped into an interesting form of lifetime sub-typing, which I think is valid, but the compiler is skeptical of. Consider the following function, which compu

If two mutable references aren’t allowed simultaneously, why are they allowed at all?

According to the documentation, Data races cause undefined behavior and can be difficult to diagnose and fix when you’re trying to track them down at run

Module parse failed for wasm module generated by rust wasm-pack

I have been following this tutorial: https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm in order to build a Rust library and use it in a VueJS pr

How to unzip a Reqwest/Hyper response using streams?

I need to download a 60MB ZIP file and extract the only file that comes within it. I want to download it and extract it using streams. How can I achieve this us

How do I implement an async Drop in Rust?

I have an async fn that returns a type, and want to implement Drop on that type that calls another async function. It's not clear how to do this, and I can't fi

How to avoid dependency on libssl.so.10 and libcrypto.so.10

My handy little rust binary is working just fine when compiled and run on pretty much every system except the Ubuntu 18.04 I need it to run on. Why, you might a

How to setup default rust compilation target on CI using rustup command on github actions?

I need to compile my code for both 32 and 64 bit windows. As far as I understand, I basically need to configure my CI so that this command: rustup default print

How to test system that requires Time resource?

I want to write tests for system that moves entities and detects collisions, system uses Res<Time> to ensure that entities move with constant speed. I was

Rust nightly not installed, please install it

I was able to build and run substrate-node-template from the instructions from the cloned repo, following the instructions at https://substrate.dev/docs/en/tuto

How do I pass a Go callback (function ptr) from Go to Rust via CGo?

I have: A Rust library that is compiled to a static C library A Go program that calls the Rust library's API via CGo I wish to pass a Go function (as callback)

Using String.replace to replace a multi-line section of the string in Rust

I am trying to use Rust to go through and make changes to an HTML file. Basically, I find specific things in the code that I want replaced, then I replace it w

How to re-run Diesel migrations?

I'm using Diesel with PostgreSQL. I added my migrations, and they worked fine, outputting everything in the schema.rs file. Until I noticed that I was missing t