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
    When writing code with traits you can put the trait in a trait bound: use std::fmt::Debug; fn ... one of several intermingled concepts) 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 find examples for constructor functions in traits, but haven't had much luck. Is this a ... terminated with error code 101 See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    I've written the following function to compare two iterators, element-by-element. However, it would be great if I could ... !(iter_eq(a, b)); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I do not expect the following code to work, but as part of grammar exploration, I tried in playground: fn main( ... the right grammar to do so? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    How can you easily borrow a vector of vectors as a slice of slices? fn use_slice_of_slices<T>(slice_of_slices: &[&[T]]) ... ]]> for Vec<Vec<T>>? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.6k views
1 answer
    Does Rust have a set of functions that make converting a decimal integer to a hexadecimal string easy? I ... I overthinking this whole thing? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
962 views
1 answer
    I'm writing some code in Rust that connects to a remote server, and depending on the messages sent by that ... actual solution would look like). See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.5k views
1 answer
    from the borrowing rule: At any given time, you can have either one mutable reference or any number of immutable ... any doc to support it. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I ran into a lifetime problem with a little game. The below code represents a very boiled down version of the ... , or why is this impossible? 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 a 2D vector that rejects indexing using i32 values, but works if I cast those values using as usize: #[ ... i32 to index shouldn't work. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    pub fn create_future( notificator: mpsc::Sender<usize>, proxy: Proxy, ) -> impl Future<Item = (), Error = () ... ? How can I solve this problem? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I'm trying to recurse down a structure of nodes, modifying them, and then returning the last Node that I get to. ... = temp, } } current } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
961 views
1 answer
    I've seen the Borrow trait used to define functions that accept both an owned type or a reference, e.g. T or ... of writing this sort of thing? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    Why doesn't the following code compile (playground): use std::collections::HashMap; fn main() { let mut h: ... still not finished in all cases? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
972 views
1 answer
    Why does code example 1 compile but example 2 gives a compilation error? Example 1: use std::ops::Index; ... be implemented for a type parameter See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    In the answer to this question there's a discussion of how to refer to trait objects held by structs which ... is a lifetime bound already. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    In Clojure, I use a function called iterate that: Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free ... => Some(3 * n + 1) } } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    I have a project with: main.rs module_1/mod.rs module_2/mod.rs module_2/module_3/mod.rs when I run cargo doc ... that. Somebody can explain me? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    struct RefWrap<'a> { wrap: &'a mut Option<String>, } impl<'a> RefWrap<'a> { fn unwrap(&mut self) -> &' ... sure it's not helpful in this case. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    When is it appropriate to mark a function as unsafe versus just using an unsafe block? I saw this function while ... to use one or the other. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
998 views
1 answer
    This is similar to Parameter type may not live long enough?, but my interpretation of the solution doesn't seem to ... am I doing wrong 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 a mutable Option type and I'm trying to mutate the thing inside the Some but I can't figure out ... an example to help me understand? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    The Error Handling chapter of the Rust Book contains an example on how to use the combinators of Option and ... done without the explicit move? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    I understand that rustup installs the rustc and cargo binaries to ~/.cargo/bin, but where does it install the ... if that makes a difference. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    I'm using rustc 1.0.0 (a59de37e9 2015-05-13) (built 2015-05-14) and I've got the following setup: my_app/ | ... `???` What am I missing? Thanks. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.4k views
1 answer
    I'm using Rust, bindgen, and a build script to work on some FFI bindings to a library. This library is ... specifying it from within build.rs? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.5k views
1 answer
    It seems that an iterator is consumed when counting. How can I use the same iterator for counting and then iterate on it? ... ("{}", value); } } 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 code that looks like this: f(a).and_then(|b| { g(b).and_then(|c| { h(c).map(|d| ... , d) } rescue NonexistentValueException { None } 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

...