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
    Consider this: loop { let data = match something() { Err(err) => { warn!("An error: {}; skipped.", ... let that would also return the ok-value. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
883 views
1 answer
    I have this code: use std::sync::atomic::{AtomicUsize, Ordering}; const SOME_VAR: AtomicUsize = AtomicUsize::new(0 ... it not work with const? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
975 views
1 answer
    According to its manual, Cargo packages can have multiple executable targets, but only one library target is ... the reasons and benefits? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
681 views
1 answer
    I really don't know how to get past this. As far as I understand it, words is moved into the closure ... pushed. Commit 633ed60 to be specific. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
874 views
1 answer
    rust-ini has a function: pub fn section<'a, S>(&'a self, name: Option<S>) -> Option<&'a ... this without the additional line with none? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
891 views
1 answer
    Why cannot I not sort an array as expected? fn main() { let mut a = [1,3,2]; let s = a.sort(); println!("{:?}", s); } 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 to implement a generic fibonacci function that works with any type implementing Zero, One, and AddAssign. ... the lifetime of f1. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
750 views
1 answer
    I have a trait that I'm using to abstract away tokio::net::TcpStream and tokio::net::UnixStream: /// ... traits. How can I handle this? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
914 views
1 answer
    I have originally asked this question here, but it was marked as duplicate, although it duplicates only a part of ... to go around this problem? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
744 views
1 answer
    This question is similar to When is it useful to define multiple lifetimes in a struct?, but hopefully different ... have the same lifetime? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
719 views
1 answer
    It is surprisingly hard to find this in the docs. This might even be a two part question: Are {integer} and ... {integer} in the current scope See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.3k views
1 answer
    I ran into a problem trying to create a generic vector for a struct. This was my first attempt: #[derive( ... like you would with an interface. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    I tried: fn main() { let mut vec = [1, 2, 3]; for mut x in &vec { *x = 3; } for mut &x in ... cannot assign to *x which is behind a & reference See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
944 views
1 answer
    I'm trying to implement an Octree in Rust. The Octree is generic over a type with a constraint that it should ... bug? How to do this properly? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
765 views
1 answer
    I am attempting to create a struct that will allow someone to call .shutdown(), which will resolve a future ( ... using nightly (2019-07-18). See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
992 views
1 answer
    I'm using rust_bert for summarising text. I need to set a model with rust_bert::pipelines::summarization::SummarizationModel:: ... ) ); } } } See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
831 views
1 answer
    How to make sense of the following piece of code? I'm new to Rust but have background on C/Haskell and a little bit C ... } println!("{}", i); } See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
765 views
1 answer
    In my ongoing saga of writing a safe wrapper for the Cassandra C++ driver, my eye now turns towards ... ::h575496cbf7644b9e6oa (cluster.rs:76) See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
853 views
1 answer
    This works: struct Foo<T, F> where F: Fn() -> Option<T>, { f: F, } but this gives me compile errors: ... but I'd like to avoid this if possible. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
882 views
1 answer
    Is there a trivial way to split a string keeping the separators? Instead of this: let texte = "Ten. Million. ... use j in the for loop. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
565 views
1 answer
    fn works<'a>(foo: &Option<&'a mut String>, s: &'a mut String) {} fn error<'a>(foo: ... interior mutability container" or something like that? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
741 views
1 answer
    I'm writing a toy programming language in Rust. I prototyped the parser logic in Ruby: def rd_tree(chars) loop do ... I want it to stay neat. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
709 views
1 answer
    I wrote some code that compiled fine, then I turned T into Option<T> and now I'm getting this error: error ... understand what's going on here? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
792 views
1 answer
    This code give me a compilation error: trait IBoo { fn new() -> Box<IBoo>; } while this code compiles ... methods in one interface (trait)? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
853 views
1 answer
    struct Point { x: u32, y: u32, } struct Line<'a> { start: &'a Point, end: &'a Point, } Here, ... possible in this situation and if so why not? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
955 views
1 answer
    I have something like this (the real function is Ini::Section::get from rust-ini): impl Foo { ... duplication without this macro implementation? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
861 views
1 answer
    I'm trying to use the new Pin feature. After reading this blog post, I've started to write some code ... with lifetime parameters with Pin? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
922 views
1 answer
    I want to write a function that accepts Iterator of type that has ToString trait. What I have in mind: fn parse ... ("Missing parameter"), } } 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

...