Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

Recent questions tagged rust

0 votes
2.2k views
1 answer
    When I create a vector, the length and the capacity are the same. What is the difference between these methods? fn main ... )); // Capacity: 5 } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.6k views
1 answer
    I'm implementing a small utility and the compiler is telling me that a variable (a TcpStream) does not live long ... but I don't know why. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.8k views
1 answer
    Is it possible to explain to the compiler that the v variable is good at the line marked as 1 without using ... like unsafe or Option::unwrap See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.0k views
1 answer
    pub type Data = i32; pub struct Foo { data: Data, } impl Foo { pub fn data_mut(&mut self) -> &mut Data ... ). What's the lifetime issue there? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.7k views
1 answer
    I have this piece of code using futures v0.1: impl ArcService for (Box<MiddleWare<Request>>, Box<ArcService>) { ... Rust v1.25.0 (nightly) See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.8k views
1 answer
    fn main() { let val = 0; unsafe { foo(&val) } } extern "C" { pub fn foo(val: *const u32); } ... I'm passing a pointer to the local variable? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.7k views
1 answer
    I have a 2D array of type f32 (from ndarray::ArrayView2) and I want to find the index of the maximum value in ... s the fastest way of doing so? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.2k views
1 answer
    I understand how lifetime parameters apply to functions and structs, but what does it mean for a trait to have a ... , or is it something else? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.7k views
1 answer
    Is it possible to create a macro which counts the number of expanded items? macro_rules! count { ($($name:ident),*) => { ... } count!(A, B, C); See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.1k views
1 answer
    According to this isuue issue and this answered question it is not possible to simply define a trait alias like: ... How should it look like? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.6k views
1 answer
    Update: The title of the post has been updated, and the answer has been moved out of the question. The short ... sure where to go from here. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.8k views
1 answer
    Sometimes I want to read a single byte from a std::io::Reader. If I try to do this: use std::io::{ ... possible or not and would like to know. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.9k views
1 answer
    I have some non-copyable type and a function that consumes and (maybe) produces it: type Foo = Vec<u8>; fn ... it possible to work around that? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.7k views
1 answer
    Is there a way to have a single function that accepts an iterator to either values or references? If not, is there a ... sum) / f64::from(len) } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.8k views
1 answer
    I am trying to make some kind of decoder, that will be able to deserialize entries without actually copying ... refactor the code somehow? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.9k views
1 answer
    I'm trying to update some older code I wrote that basically looks like: trait Foo<T>{} struct Bar<A, B: Foo ... now, or am I missing something? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.0k views
1 answer
    I have data contained inside a Box, and would like to pattern match on it without accidentally copying the Box's ... :AnotherEntry => {} } } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.1k views
1 answer
    I'm spawning a thread that does some work. Sometimes I want this thread to die after the work is finished, other times I ... no!"), } } }); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.8k views
1 answer
    This is my code: use std::ptr; struct Query<T>{ data: T, prev: & Query<T>, next: & Query<T>, } impl<T> ... &Query<T>. How do I fix this error? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.7k views
1 answer
    The async/await feature is coming soon, but there are a lot of libraries still using futures 0.1. How do we convert ... achieve this ? Ok(()) } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.1k views
1 answer
    I want a vector for elements that contain a trait such as Eq and I need heterogeneous vectors. For ... compare regardless of their types? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.7k views
1 answer
    I needed to pass a resource between several functions which use a closure as an argument. And within these the ... Mutex, I have some doubts. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.8k views
1 answer
    Assume the following contrived example: struct Board { squares: Vec<i32>, } struct Point<'a> { board: &'a ... tied to the struct creating them? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.4k views
1 answer
    I'm trying to write code that gets the last element of some vector and do different actions (including mutation ... my code fails to compile? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.3k views
1 answer
    To learn Rust, I'm looking at things like the HackerRank 30 days challenge, Project Euler, and other ... do this idiomatically in Rust? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.0k views
1 answer
    I'm getting an error[E0275]: overflow evaluating the requirement on this simple code, and I don't know how to resolve ... ...>>>>` for `String` See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.9k views
1 answer
    We have a 'delete all my data' feature. I'd like to delete a set of IPs from many many web log ... binary to deploy with no dependencies. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.1k views
1 answer
    The Rust Reference says: The left operand of an assignment or compound-assignment expression is an lvalue ... for (compound-)assignments? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
Ask a question:
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...