Looking for questions to add to the Rust FAQ

Hi everyone!

The official Rust FAQ needs some love. It hasn't seen any serious updates since it initially launched, and it doesn't cover a variety of areas that it should.

So, just like when the FAQ was first being worked on, we're looking for suggestions for questions that should be added!

There are a few areas in the current FAQ that are definitely light on content. Questions in these are appreciated.

  • Design Patterns
  • Libraries
  • Cross-Platform
  • Low-Level
  • Debugging and Tooling
  • Macros
  • Concurrency
  • Modules and Crates
  • Documentation

Additionally, there are some areas where questions definitely need to be updated. If you have particular issues / concerns in these areas, please share!

  • Higher-kinded types / Associated-type constructors
  • Doing object-oriented programming in Rust
  • How to do asynchronous I/O in Rust

Of course, any feedback is appreciated! What questions are on your minds?

5 Likes

I think design patterns on interior mutability, when to use Ref/Cell/Box and how to deal in cases when we need interior mutability (for instance often comes in when you need to modify a graph within a graph method etc...) and guidelines on this kind of a bit more challenging situation for wrestling Rust's borrow checker would be nice to have.

2 Likes

Android Studio / NDK integration : I'd love to convert my C++ NDK library embedded in my Java Android project to Rust, but the tooling is so obtuse that I am sticking with C++.

1 Like

@QuadDamaged

You can look at https://github.com/Dushistov/rust_swig/tree/master/android-example as example of project that uses ndk + jni + rust + java.

1 Like

With regards to async I/O, "How do I asynchronously load a file from disk?". Every few months I head to Google with that question. So far, the only answer has been "Spawn a thread to do it", but I've had to dig around in forum posts and Reddit threads to get confirmation that nobody has put together a crate for doing async file I/O in a platform-independent manner.

1 Like

I am a new user here, i would like to know what is the current state of Rust on the windows platform. Both in the development and compilation.

I do not know Rust enough but i think this is a valid question that should be on the FAQ.

1 Like

Educated guess: The reason why we don't have a cross-platform asynchronous file I/O abstraction is likely that some major target platforms (such as Linux) don't provide a decent interface for asynchronous disk I/O to begin with.

2 Likes

Thanks for all the questions, everyone!

@HadrienG, just a correction: Rust does have a pretty standard cross platform async IO library on which any other async IO lib you find is generally based. It's called mio: https://github.com/carllerche/mio

1 Like

Sorry for not expressing myself clearly enough. I was referring to disk IO here, not IO in a general sense or networked IO in particular.

Most popular operating systems have good abstractions for asynchronous network IO, which is why crates like mio can exist. But fewer operating systems have usable (i.e. feature-complete, efficient and bug-free) asynchronous disk IO, which is likely why the later is explicitly marked as falling out of mio's scope in the README.

1 Like

Yeah, I've seen that explanation come up before. If there's a genuine reason why Rust can't have platform independent async file I/O, then that would be especially good to mention in an FAQ.

Thinking about it, this might be better addressed by the cookbook than the FAQ. I keep forgetting that the cookbook is (or will be) a thing.

@excaliburHisSheath The cookbook is very much a thing (a pre alpha in progress but a thing nonetheless ;)) . If you have an idea that you can formulate you can comment on async io issue in our repo :slight_smile:

Use or not use inline attribute for one line functions?

1 Like

I'd hope that the compiler does inline it spontaneously, and only add explicit inline directives if it doesn't do so and that turns out to be a performance problem.

It would be good to have some coverage of deref coercions. More generally, I think it would be good to cover a bunch of the standard traits, what they are meant for, and how to the standard library uses them.

You might find some good candidates among the most viewed #help topics: