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
934 views
1 answer
    When I look at File's docs, I see that the take method takes a self, not a &self. But I'm still able to call ... here? (using rustc 1.3.0-dev) See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
915 views
1 answer
    I have a function that reads in a file, and for each line adds it to a HashSet of type &str, but I can't ... I want to keep it around longer? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    What is a good way to extract data from a &Result type? In my specific case, I have a &Result<DirEntry, Error> ... :Error> : std::clone::Clone` See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
979 views
1 answer
    I'm using an example provided by the Tokio library and attempting to have a vector of all the currently ... without writing any unsafe code? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
941 views
1 answer
    I want to write the following function: fn foo<'a, 'b, 'c>(rr1: &'a mut &'c mut u32, rr2: &'b mut ... way instead of the way I thought they do? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
953 views
1 answer
    I'm trying to create a method that returns an iterator over the values of HashMap that is boxed inside a RefCell, ... or is there a better way? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
838 views
1 answer
    The following code involves a very subtle bit of borrow checker dodging. The code itself describes the reasoning ... mutable borrow occurs here See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
828 views
1 answer
    The following two lines: let x = Box::new(("slefj".to_string(), "a".to_string())); let (a, b) = ... I'm pattern matching deep into a structure. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
940 views
1 answer
    I have the following struct: #[derive(Debug)] pub struct Entry { pub index: usize, pub name: String, pub ... of anything like that in Rust. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I want to write a custom build.rs script that generates some diagrams to accompany the documentation for a crate I'm ... "debug" or "release". See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    I want to use an EDN parser but it is inside https://github.com/mozilla/mentat. https://github.com/ ... this crate inside the mentat repository? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    The current edition of The Rustonomicon has this example code: use std::mem; pub struct IterMut<'a, T: ' ... is about returning a reference. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
984 views
1 answer
    I'm attempting to learn Rust by implementing a simple in-memory URL shortener with Hyper 0.10. I'm running ... message is very cryptic to me. See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
870 views
1 answer
    I'm trying to implement the Chain of Responsibility design pattern in Rust: pub trait Policeman<'a> { fn ... of Responsibility pattern in Rust? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    I want to implement FromStr for a struct with a lifetime parameter: use std::str::FromStr; struct Foo<'a> { bar: &'a ... 'a>, ()> { | ^ Playpen See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    Here is an offending example (Playground): // Some traits trait Behaviour { type Sub: SubBehaviour; } trait ... get this code to work? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
875 views
1 answer
    I'm building a library that implements string joins; that is, printing all the elements of a container ... through deref coercion, right? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    If I want to consume an iterator by hand, it has to be mutable: let test = vec![1, 2, 3]; let mut ... right? Is there more to be explained? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
940 views
1 answer
    This question is now obsolete because this feature has been implemented. Related answer. The following Rust code ... type implements the 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 a trait Foo inheriting from another trait Bar. Bar has an associated type Baz. Foo constrains Baz such ... recommended way to do this? 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 in Rust which I am trying to index with a dynamic u8 variable. An example of what I'm ... it as an index in my vector? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    I was trying to create a derive macro for my trait, to simplify some stuff. I've encountered some problems: ... the reason for this behavior? 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 definition: enum Either<T, U> { Left(T), Right(U), } How would I get the ... ^^ cannot move out of borrowed content 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 several regular expressions that are defined at runtime and I would like to make them global variables. To ... another way to do 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'm given a data-format that includes a sequence of objects with exactly one named field value each. ... still using it using deserialization? See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
958 views
1 answer
    What is the difference between these two cases? Why does the commented line compile but the last line in the main ... collect() as String ); } See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
753 views
1 answer
    I have C code to bridge to. I chose to use mem::uninitialized to claim the memory first, then call ... do something user addr: 0x7fff5b948ba0 See Question&Answers more detail:os...
asked Oct 24, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    Consider the following (illegal) example: enum Foo { Bar { i: i32 }, Baz, } struct MyStruct { field: Foo:: ... struct MyStruct { field: Bar, } 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

...