Questions tagged [Rust] (47)

2
answers

Is it appropriate to compile a dll with a class inside it?

There is a very convenient Liba (Krat), I want to write over it a wrapper simplifying a lot of the routine and give in the form of a dll for writing software in c++. The pros have been uploaded yet class for working with him. Googled - like you, but (honestly) don't want to go and to stumble on a rake for nothing. How diffi...
Kameron_Grimes7 asked April 19th 20 at 12:35
3
answers

Rust — another killer c/c++?

Recently I saw a conference on rust and there a bearded guy from Intel said that c/c++ the new Assembly which will replace the rust as well as si assembler. For fun, I decided on the website hh.ru and rust vacancies less than in assembler, and no jobs for the Junes although the above mentioned assembler language I found alm...
Casey.Erdman asked April 19th 20 at 12:28
2
answers

Whether it is allocated memory when creating &str?

There is an array of bytes and I want the first 10 bytes to convert to a string . if I do String::from_utf8_lossy() it will return &str. Do I understand correctly that &str is the address of those 10 bytes and virtual memory will be allocated only create links ? Thank you!
Samara.Flatley18 asked April 7th 20 at 09:51
1
answer

Use String or &str?

I want to parse the request from the browser . Let's say I got a byte array and I need it to structurewhat . The question is, what is better to use links to data found in the array or directly own data.
Ida_Ullrich14 asked April 7th 20 at 09:51
1
answer

Whether it is allocated memory when the transmission of the slice?

Good day! Let's say I have an array of bytes and I need it to convert to a string. To do this, I run through the array to the correct bytes, create a slice and pass to another function. As I understand it slice it's just a reference to the array elements, and therefore not to allocate memory ? Equivalent if an array of refe...
spencer.Rice23 asked April 4th 20 at 13:32
1
answer

In Rust arrow -> in the function Declaration foo()->i32{ for beauty?

This arrow is purely decorative or, as it helps the parser? Possible valid design without arrows of the formfn foo(arg) type{ which would mean something other than declaring the function? Like Rust very compressed syntax is function to two of the letters reduced, and the arrow of beauty left, that Haskell was like?))
Rickey asked April 3rd 20 at 18:57
2
answers

Where I have error in training a neural network?

Good time of day! Please tell me whether I understood the algorithm of backpropagation . Example of a network. Input = Sample matrix 784x1 The input layer = Input matrix 10х784 Hidden layer = Hidden matrix 10x10 Output layer = Out, matrix 10x10 After the live distribution has received: Layer A = Sample * Input Layer B = A *...
Myrtice_Wa asked April 3rd 20 at 18:31
1
answer

How to cast template type T: Num to any other type that implements the Num?

There is a crate num. He has a trait Num, which describes the properties of all numeric types in Rust (as primitive, and not very much). In template code, I can afford to cast any numeric type to any other (responsible for narrowing types, I assume). However, I cannot find the same method for templated code. For example, I...
Jessica_Kilback70 asked April 3rd 20 at 16:47
1
answer

How to get the index buffer for drawing a square in OpenGL?

This is my code, but as a result I have only displays the window.extern crate gl; extern crate sdl2; use gl::types::*; use std::ffi::CString; use std::ptr; use std::str; // Shader sources static VS_SRC: &'static str = " #version 330 core layout (location = 0) in vec4 Position; void main() { gl_Position = Position; ...
Katelyn.Steub asked April 1st 20 at 17:41
1
answer

Why error occurs in reqwest if you do not use tokio::main?

If you use #[tokio::main] then the code runs successfully:Codeuse futures::executor::LocalPool; use futures::task::LocalSpawnExt; async fn test(n: i32) { println!("Started: {}", n); let response: String = reqwest::get("https://www.rust-lang.org") .await .unwrap() .text() .await .unwrap(); println!("Completed: {}. Respon...
Candice.Koch90 asked April 1st 20 at 16:23