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
1.3k views
1 answer
    This issue seems to imply it's just an implementation detail (memcpy vs ???), but I can't find any explicit description of the differences. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.7k views
1 answer
    A new Rustacean like me struggles with juggling these types: String, &str, Vec<u8>, &[u8]. In time, I hope to have ... > String Vec<u8> -> &[u8] See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    I have a simple piece of code that is supposed to read a file into a vector by lines use std::io::{self, ... I really want to return a vector. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    I have a big struct Foo<Q>, and want to map it into a Foo<R> where most of the fields don't need ... map-like methods for non-trivial structs? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    Given the following function: use std::io::{BufRead, stdin}; fn foo() -> usize { let stdin = ... seemingly retained for longer than expected? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    I am struggling with the basics of object safety. If I have this code struct S { x: i32, } trait Trait: Sized { ... -> i32 where Self: Sized; } See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    use std::iter::Iterator; trait ListTerm<'a> { type Iter: Iterator<Item = &'a u32>; fn iter(&'a self) ... opportunity to do that in my use case. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    Reading through the Rust book, I came across an interesting topic - divergent functions: Rust has some special ... divergent functions in Rust? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    Given the following program: struct Data { pub items: Vec<&'static str>, } trait Generator { fn append( ... through accessor methods like this. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    My goal is to make a function (specifically, floodfill) that works independent of the underlying data structure. ... way of combining closures? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.6k views
1 answer
    Do all primitive types in Rust implement the Copy trait? It would be interesting to know, as surely such ... of a new programming language. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    First, let the code speak: #[derive(Debug)] struct Bar; #[derive(Debug)] struct Qux { baz: bool } # ... the ownership/borrowing system in Rust. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    I'm writing a library in Cargo. If this library depends on another library like libc, which exposes a feature ( ... way specified to do this. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    I want to use Serde to create an array with error messages as well as proper objects: extern crate serde; // 1 ... array would be nice as well. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    I'm using a complex key for HashMap such that the key comprises two parts and one part is a String, and I can't ... , but I'm at a total loss. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.6k views
1 answer
    I have this: #[derive(FromPrimitive)] pub enum MyEnum { Var1 = 1, Var2 } And an error: error: cannot find derive ... get this? How do I fix it? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.5k views
1 answer
    I want to do something like: let x = 123; let mut buf = [0 as u8; 20]; format_to!(x --> buf); ... a memory allocator. How can I do this? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    Why do I need rebinding/shadowing when I can have mutable variable binding? Consider: let x = a(); ... some advantages over mutable bindings? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    I have the following code (Playground): // Two dummy functions, both with the signature `fn(u32) -> bool` ... foo and bar different fn items? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.7k views
1 answer
    I have this enum type: enum Animal { Dog(i32), Cat(u8), } Now I have a function that takes this ... write this shorter and/or more idiomatic? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    Why are both &[u8] and &[u8; 3] ok in this example? fn main() { let x: &[u8] = &[1u8, ... ? In what other conditions does this coercion happen? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.9k views
1 answer
    In order to get a feel for how Rust works, I decided to look at a little terminal-based text editor called ... if_let)] to the crate attributes? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.3k views
1 answer
    Here is what I am trying to do: use std::collections::HashMap; fn main() { let mut my_map = HashMap::new(); ... there a way to update a value? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.6k views
1 answer
    I'm trying to compute the 10,001st prime in Rust (Project Euler 7), and as a part of this, my ... access it within the vectorIsPrime function? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.0k views
1 answer
    I have two modules in separate files within the same crate, where the crate has macro_rules enabled. I want to use ... do I work around that? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    Before I stumbled upon the code below, I was convinced that a lifetime in a type's lifetime parameter would ... reasoning of the compiler here? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    Editor's note: this question was asked before Rust 1.0 and some of the assertions in the question are not ... Does that even make any sense? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    My first program in Rust is supposed to take input from the user in the form of characters, either C or F: ... that I pressed F previously? V See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
To see more, click for the full list of questions or popular tags.
Ask a question:
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...