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
996 views
1 answer
    I have a some JSON data that is returned from a web service. The JSON is a top-level array: [ { " ... Serde not deserialize top level-arrays? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.0k views
1 answer
    I need to convert &[u8] to a hex representation. For example [ A9, 45, FF, 00 ... ]. The trait std:: ... is the most canonical way to do this? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
755 views
1 answer
    A FnMut closure cannot be cloned, for obvious reasons, but a Fn closure has an immutable scope; is there some way to ... 't clone a &Fn<...>. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
735 views
1 answer
    From the Rust guide: To dereference (get the value being referred to rather than the reference itself) y, we use ... or did I miss something? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
760 views
1 answer
    Regular float literals do not work: extern crate num_traits; use num_traits::float::Float; fn scale_float<T: Float>(x ... ` found type `{float}` See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
578 views
1 answer
    I have a struct that mostly encapsulates a vector: struct Group<S> { elements: Vec<S> } I also have a simple ... Solid>> isn't a great option. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
784 views
1 answer
    I have a trait with an associated type and a generic struct:: trait Generator { type Foo; fn generate(&self) ... a where clause that matches it. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
697 views
1 answer
    I read the below syntax from byteorder: rdr.read_u16::<BigEndian>() I can't find any documentation which ... instance.method::<SomeThing>() See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
752 views
1 answer
    I have this trait and simple structure: use std::path::{Path, PathBuf}; trait Foo { type Item: AsRef<Path ... to make this work? Rust playground See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
623 views
1 answer
    Is there a way to invoke a system command, like ls or fuser in Rust? How about capturing its output? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
952 views
1 answer
    I've made a library: cargo new my_lib and I want to use that library in a different program: cargo new my_program - ... version of Rust (1.3). See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
732 views
1 answer
    The compiler says that e1: &i32 and e2: i32. Having read the docs for slice::Iter and the book chapter on loops, I'm ... ", e2); // case 2 } } See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
936 views
1 answer
    I tried to implement fizzbuzz in Rust and failed with some arcane error: fn main() { let mut i = 1; while i ... do I avoid them in the future? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
666 views
1 answer
    Consider the following Rust code [playground]: use std::collections::HashMap; use std::hash::Hash; trait Foo ... possible to have this behavior? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
576 views
1 answer
    I am working through examples in Rust by Example. #[derive(Debug)] struct Point { x: f64, y: f64, } ... the assignment on the previous line? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
813 views
1 answer
    Why doesn't this code compile: fn use_cursor(cursor: &mut io::Cursor<&mut Vec<u8>>) { // do some ... 't understand about the borrow-checker? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
963 views
1 answer
    In the second edition of The Rust Programming Language (emphasis mine): Function pointers implement all three of the ... does this not work? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
772 views
1 answer
    Consider the following implementation: pub struct BST { root: Link, } type Link = Option<Box<Node>>; struct Node ... my Link typedef in Rust? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
628 views
1 answer
    I'm hoping to be able to use .into() to convert a value in a context where type inference is impossible. This ... Is there a trick I am missing? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
603 views
1 answer
    After discussing/learning about the correct way to call a FFI of the Windows-API from Rust, I played with it a little ... "0.2" widestring = "*" See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
663 views
1 answer
    Given this code: struct RefWrapper<'a, T> { r: &'a T, } ... the compiler complains: error: ... introducing the syntax Another maybe related RFC See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
700 views
1 answer
    When you have an Option<&T>, the compiler knows that NULL is never a possible value for &T, and encodes the ... as None. Is this possible? 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 write a program that involves filtering and folding over arrays. I've been using The Rust ... with the array behaves differently. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
617 views
1 answer
    I am very interested in Rust and am now starting my first non-trivial project in the language. I am still ... right direction. Thanks a lot. See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.2k views
1 answer
    Here's a synthetic example of what I want: macro_rules! define_enum { ($Name:ident { $($Variant:ident),* }) => { pub ... !(Foo { A, B, }); See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
700 views
1 answer
    What is the closest equivalent Rust code to this Python code? a, b = 1, 2 a, b = b, a + b I am trying ... , fib = fib, fib + fibPrev return fib See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
605 views
1 answer
    It seems like every introductory document for Rust's enum types explains how to match on an enum object that you ... a reference to an enum? See Question&Answers more detail:os...
asked Oct 17, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
783 views
1 answer
    I presume you do something like this: extern crate uuid; use uuid::Uuid; use std::fmt::Formatter; use std::fmt:: ... it. What am I doing wrong? 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

...