Questions tagged [rust]
Rust is a systems programming language without a garbage collector focused on three goals: safety, speed, and concurrency. Use this tag for questions about code written in Rust. Use an edition specific tag for questions that refer to code which requires a particular edition, like [rust-2018]. Use more specific tags for subtopics like [rust-cargo] and [rust-macros].
rust
41,910
questions
0
votes
0
answers
14
views
Side effects of constructing an explicitly unused object
Say I have a struct that provides a method that does some work (has useful side effects) and then returns an instance of itself. Do I have to use that instance somehow in order to guarantee that the ...
0
votes
0
answers
14
views
Minimp3 Rust - "slice::get_unchecked_mut requires that the index is within the slice"
While developing an audio-centered application, I came across an issue with the minimp3/minimp3_fixed crate when using it to decode mp3 files. The error/output looks like this:
Decoding MP3 File.
...
0
votes
1
answer
18
views
Error E0307: Invalid self Parameter Type in Rust Method with Rc<RefCell>
I am writing the following code in Rust
struct Node {
value: i32,
parent: Option<Weak<RefCell<Node>>>,
children: Vec<Rc<RefCell<Node>>>,
}
impl Node {
...
0
votes
0
answers
7
views
Using Rust's k256 crate, how to sign a message using ECDH's EphemeralSecret and ECDSA?
I am trying to implement the Ethereum handshake procedure (RLPx) at low level, as specified here:
https://github.com/ethereum/devp2p/blob/master/rlpx.md
I am using the k256 crate which provides ...
2
votes
0
answers
13
views
How to upload BC7 mipmaps less than 4x4 for D2Array?
I'm compressing images using the intel_tex_2 crate. I'm uploading using the wgpu crate. Texture format is Bc7RgbaUnorm. Everything works fine until I have more than 1 D2Array layer and less than 4x4 ...
1
vote
1
answer
27
views
Clamp matrix cells in nalgebra
The following code clamps each cell in a nalgebra square DMatrix. Is there a way to do this in a more "vectorized" fashion, say, using SIMD instructions?
for r in 0..m.shape().0 {
...
0
votes
0
answers
27
views
Subdividing Font Space in the Terminal for High-Definition Pixel Art
I just started programming as a hobby three weeks ago, and I'm amazed at what I can do. I exclusively use Rust.
Before I try making a game with a GUI, I want to create a simple one in the terminal. ...
0
votes
0
answers
14
views
How to send messages using libp2p through a functions in Rust?
I'm working on a Rust project where I need to send and receive messages using libp2p.
I have set up a basic libp2p structure with gossipsub for message propagation and mdns for peer discovery.
I used ...
-1
votes
0
answers
25
views
How come the Rust Compiler says Glutin doesn't have glutin::window::WindowBuilder
I tried using use glutin::window::WindowBuilder and extern crate glutin and the compiler still says that Glutin doesn't have glutin::window::WindowBuilder.
After installing the latest version (with ...
0
votes
0
answers
34
views
Rust installation issue at non-standard path [duplicate]
I have installed rust at non-standard path (I dont have root permission ) by following steps.
Downloaded https://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz
cd ~/.rust
tar ...
0
votes
0
answers
27
views
Getting console errors when trying to run model in browser using rust, wasm and wonnx
I'm attempting to embed some text as vectors in the browser using rust, webassembly and wonnx.
When I try and run my model in the demo, I get these errors in the console:
wonnx_embeddings_repro_bg.js:...
-1
votes
1
answer
24
views
PKCS11 cannot Initialize: called `Result::unwrap()` on an `Err` value: Pkcs11(GeneralError)
I try to open new session to softhsm2.
let pkcs11 = Pkcs11::new(
env::var("PKCS11_SOFTHSM2_MODULE")
.unwrap_or_else(|_| "/usr/lib/softhsm/libsofthsm2.so"....
0
votes
0
answers
19
views
special_tokens parameter of SentencePieceBPETokenizer.train_from_iterator()
I want to train a custom tokenizer from scratch. Following some online tutorials, they suggest adding a series of special tokens to the train_from_iterator() function:
special_tokens = ["<unk&...
1
vote
1
answer
60
views
Why does using `extern` allow for runtime linking?
I have this code snippet:
extern crate blas;
extern crate openblas_src;
pub fn eigen_decompose_symmetric_tri_diagonal(
main_diag: &Vec<f64>,
sub_diag: &Vec<...
-1
votes
0
answers
35
views
Rust cdylib websocket fatal runtime error: global allocator may not use TLS
I'm writing rust dll, cdylib which supposed to start new thread and connect to websocket using tokio::tungstenite
i load dll reflectivly into rust program using https://github.com/indygreg/rs-memory-...