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.0k views
1 answer
    Rust has the ability to check configuration at build time with, e.g., #[cfg(target_os = "linux")] or ... list of standard attributes anywhere?. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    How can I get the current time in milliseconds like I can in Java? System.currentTimeMillis() See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    How can I iterate over a range in Rust with a step other than 1? I'm coming from a C++ background so ... step. How can I accomplish this? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
731 views
1 answer
    The Cargo FAQ states that Cargo.lock is not used for libraries, instead using dependency version ranges found ... modifying the package myself. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
788 views
1 answer
    I'm interested in using wasm-bindgen via rust-webpack-template to compile Rust code to WebAssembly. However, I ... to code defined elsewhere? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
596 views
1 answer
    According to the Rust book, "when a binding goes out of scope, the resource that they're bound to are freed". Does ... More stuff } // Or here? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
845 views
1 answer
    I have a struct which looks something like this: pub struct MyStruct<F> where F: Fn(usize) -> f64, ... than that of mystruct.mapper. playground See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
891 views
1 answer
    I would like to use a HashSet as the key to a HashMap. Is this possible? use std::collections::{HashMap, HashSet}; ... ::HashMap<K, V>>::new` See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
770 views
1 answer
    I am reading Object Safety Is Required for Trait Objects and I don't understand the problem with generic type ... paragraph I'd be grateful. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I am trying to iterate on on Option<Vec<>>. #[derive(Debug)] pub struct Person { pub name: Option<String> ... is the link to the playground. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
782 views
1 answer
    I was reading the RFC on "expanding" impl Trait when I came upon the following: By contrast, a programmer ... and the second one existential? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I have code that creates a RefCell and then wants to pass a reference to that RefCell to a single thread: use ... than happy to be told why. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
692 views
1 answer
    trait FooTrait {} struct FooStruct; impl FooTrait for FooStruct {} fn main() { let maybe_struct: Option<dyn FooStruct> ... obvious, or... huh? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
960 views
1 answer
    I have a JSON structure that looks like this: { "type": "suite", "event": "started", "test_count": 1 } I ... like to be able to use PascalCase. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
667 views
1 answer
    I'm trying to call closure that was saved inside a struct but I'd also like to pass the struct as an ... will avoid this double borrow attempt? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
779 views
1 answer
    I'm trying to write a program to evenly (or as close to possible) distribute points about the surface of a ... m now absolutely stuck for ideas. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
657 views
1 answer
    I am reading the second edition of the Rust Book and I found the following sample in the iterators section ... an immutable variable to mutable? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
661 views
1 answer
    For reasons related to code organization, I need the compiler to accept the following (simplified) code: fn f() ... compile this in safe Rust? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
654 views
1 answer
    I'm writing a bot for halite.io, and am having issues understanding some of the effects of borrowing. ... be available to borrow afterwards? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
2.2k views
1 answer
    I'm trying to read the values from a vector and use the values as indexes to perform an addition: fn main( ... not implement the `Copy` trait See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
658 views
1 answer
    I am modeling an API where method overloading would be a good fit. My na?ve attempt failed: // fn attempt_1( ... ? Is there a cleaner way? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
650 views
1 answer
    I have a function that takes an argument of type u16. Is there an elegant way to define a custom data type ... has values between 0 and 100? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
745 views
1 answer
    I'm trying to manipulate ASTs in Rust. There will be lots of manipulations, and I want my trees to be ... should I do it completely differently? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
847 views
1 answer
    I'm trying to create a generic struct which uses an "integer type" for references into an array. For performance ... any way to express this? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
985 views
1 answer
    I have a &[u8] slice over a binary buffer. I need to parse it, but a lot of the methods that I would like ... so I don't think split will work. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
994 views
1 answer
    I'm trying to use some Rust libraries from crates on Github. This is the first time I've tried to do this. The ... 2014-12-21 20:43:45 +0000) See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
716 views
1 answer
    Foo can be modified using the method .modify(): struct Foo; impl Foo { fn modify(&mut self) {} } Bar ... a similar guarantee for item 2? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    I tried to compile the following code: extern crate rand; // 0.6 use rand::Rng; fn main() { rand::thread_rng ... How can I go further from here? 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

...