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
629 views
1 answer
    I want to get the name if it's not empty or set a new value. How can I do that? #[derive(Debug)] ... in a macro outside of the current crate See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    I want a function to allocate a basic variable-length "array" (in the generic sense of the word, not necessarily the Rust ... Box::new(sl); } } See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
578 views
1 answer
    I have two Vecs that correspond to a list of feature vectors and their corresponding class labels, and I'd like ... it would be much better. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
821 views
1 answer
    I am looking for a way to chain the usage of the try! macro in Rust and found this pull request ... macro or are there important differences? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    Is there a way to check whether data is available on stdin in Rust, or to do a read that returns immediately with the ... ...} // this blocks :( See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
672 views
1 answer
    My project's path structure is as follows: demo ├── benches │?? └── crypto_bench.rs ├── src │?? ├── main.rs │ ... a project with a main.rs file. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I'm trying to develop a message routing app. I've read the official Rust docs and some articles and ... give me the right implementation. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
863 views
1 answer
    I have a Vec<Result<T, E>> and I want to ignore all Err values, converting it into a Vec<T>. I can do ... Is there a better way to write this? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
887 views
1 answer
    I have a crate with production code in the src directory and integration tests in the tests directory. The ... the tests main function? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
977 views
1 answer
    use std::fs::File; use std::io::Read; pub struct Foo { maybe_file: Option<File>, } impl Foo { pub fn init( ... ? What do I do to solve it? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
919 views
1 answer
    In Go, copying slices is standard-fare and looks like this: # It will figure out the details to match slice ... better way to copy a slice? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
750 views
1 answer
    Editor's note: This code example is from a version of Rust prior to 1.0 and the code it uses does not ... correct way to use MemoryMap in Rust? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
621 views
1 answer
    How can I create a function with a variable number of arguments in Rust? Like this Java code: void foo(String.. ... System.out.println(arg); } } See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
893 views
1 answer
    I tried the following code: fn main() { let v2 = vec![1; 10]; println!("{}", v2); } But the ... Does anyone implement this trait for Vec<T>? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
851 views
1 answer
    I wasn't able to find the Rust equivalent for the "join" operator over a vector of Strings. I have a ... iterator separated by spaces 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'd like to make a project with a daemon and a client, connecting through a unix socket. A client and a ... unless it's very good practice. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I'm having a hard time figuring out how string syntax works in Rust. Specifically, I'm trying to figure out how to make a multiple line string. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
609 views
1 answer
    I have a trait Foo pub trait Foo { fn do_something(&self) -> f64; } and a struct which references that trait pub ... foo } } fn main() {} See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    Given the macro matching example, this shows how macros can match an argument. I've made very minor changes here to ... be passed to a macro. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
906 views
1 answer
    I have one object that owns another. The owned object has a mutating method that depends on non-mutating ... complex logic with the results. 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 function f that accepts two references, one mut and one not mut. I have values for f inside ... in comparison with HashMap::get/get_mut See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
896 views
1 answer
    I'm looking for a way to eliminate the temporary vector allocation in this example: fn doit<T: Iterator<Item ... iterating on the first error. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
737 views
1 answer
    I want to group similar functions in a file. Those functions need to return a type which is not public: ... this without making MyStruct public? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
908 views
1 answer
    I want to implement a trait for both a for reference and non-reference type. Do I have to implement the functions twice, ... .hi(); &bar.hi(); } See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
867 views
1 answer
    I'm implementing a stack-like structure, where the structure holds a mutable reference to a slice. struct ... interested in more explicitly? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I tried to derive serde::Deserialize for a struct containing a reference to a Path. This yielded an error message ... think this is a bug. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
901 views
1 answer
    I have a function that is capable of being implemented as a const: #![feature(const_fn)] // My crate ... pub (and other visibility modifiers) See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    I'm trying to return a slice from a vector which is built inside my function. Obviously this doesn't work because ... collect(); v.as_slice() } See Question&Answers more detail:os...
asked Oct 17, 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

...