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.2k views
1 answer
    I've been looking over the documentation, and so far I haven't seen a built in function to safely move an item ... index: usize) -> Option<T>? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.5k views
1 answer
    I'm trying to use enum variants to capture data which is heterogeneous in nature (has different collections of fields) but ... ("{}", n); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    I'm trying to make something like a "callback system". For example, there is a window and a couple of buttons in it. ... ::new(); wnd.run(); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I was looking through Rust's source code to better acquaint myself with the language. I came across this snippet. / ... did they do it this way? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.5k views
1 answer
    trait Actor{ fn actor(&self); } trait Health{ fn health(&self); } struct Plant; impl Actor for Plant{ fn actor( ... "Has no Health trait");} } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    I have following code and don't know how to get it working: fn new_int<'a>() -> &'a isize { &5 } fn main() { ... main() { let x = new_int(); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.5k views
1 answer
    I don't completely understand lifetimes, but I think b's lifetime will end before self's. So, how to edit ... valid for the static lifetime... See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    I have the following simplified code: fn f() -> i32 { let a = some_result.unwrap_or_else(|_| { return 1; // ... I have the trivial Ok match arm. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.6k views
1 answer
    Is there any way to accomplish something like the following: let v = vec![1, 2, 3]; let (a, b) = v ... but I would like to have named variables. 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 using the structs Foo and Bar from a library and I'm getting a compilation error in the client code. I ... , but I cannot fix the problem. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    Suppose I want to create some type that wraps some other generic type, like so: struct MyWrapper<T> { pub ... apart from the compiler message? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.5k views
1 answer
    I have a trait Trait with an associated type Trait::Associated. I am trying to bound the trait by requiring ... to use generics? Playground. 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 trying to use a for loop to iterate over a vector of functions and execute each function at each step. ... back, or am I missing something? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    There is a new Pin type in unstable Rust and the RFC is already merged. It is said to be kind of a game ... anyone explain it in layman's terms? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    I have an SQL table that I want to work with through Diesel: CREATE TABLE records ( id BIGSERIAL PRIMARY KEY, record_type ... } dotenv = "0.9.0" See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.6k views
1 answer
    If I have an enum with a set of values, is there a way I could create a second enum with the same variants ... { Alpha, Beta(usize), Gamma, } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    I have a custom struct like the following: struct MyStruct { first_field: i32, second_field: String, third_field: ... should it be implemented? 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 trying to figure out how to send a function through a channel, and how to avoid extra cloning in ... be sending functions through channels? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    Can someone explain to me why Rc<> is not Copy? I'm writing code that uses a lot of shared pointers, and ... , right? Am I missing something? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
919 views
1 answer
    I have some structs that implement both Hash and MyTrait. I'm using them as &MyTrait trait objects. Now I want ... to apply that solution here. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I have some structs that implement both Hash and MyTrait. I'm using them as &MyTrait trait objects. Now I want ... to apply that solution here. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I have some structs that implement both Hash and MyTrait. I'm using them as &MyTrait trait objects. Now I want ... to apply that solution here. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    Can someone explain to me why Rc<> is not Copy? I'm writing code that uses a lot of shared pointers, and ... , right? Am I missing something? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    I have some structs that implement both Hash and MyTrait. I'm using them as &MyTrait trait objects. Now I want ... to apply that solution here. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    Here's a (somewhat contrived) example to illustrate what I would like to do pub trait Node: Eq + Hash { type ... its name and cannot find it. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.0k views
1 answer
    I am working on a basic shell interpreter to familiarize myself with Rust. While working on the table for storing ... :JobsList(vec![]); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    One uses this to send output to stdout: println!("some output") I think there is no corresponding macro to do the same for stderr. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    The Rust documentation covers Rc<RefCell<T>> pretty extensively but doesn't go into RefCell<Rc<T>>, ... an important difference between them? 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

...