Code Organization and Application Architecture
- What are four ways of grouping code into modules?
Our workshop model has four ways of grouping code together: by type, by purpose, by layer, and by convenience.
- What does FFI stand for?
FFI stands for Foreign Function Interface.
- Why are unsafe blocks necessary?
The unsafe
syntax in Rust indicates that you want to use superpowers and that you accept the responsibility.
- Is it ever safe to use unsafe blocks?
Nothing is safe. There is an ongoing effort by core Rust developers to rewrite standard library code to use fewer unsafe features. Still, depending on how far down you look, there is no absolute safety in any context. For example, the core compiler is just assumed to always be logically consistent with regards to safety checks (hopefully it is).
- What is the difference between a
libc::c_int
and ani32
?
c_int
is a direct alias—type c_int = i32;
.
- Can linked libraries define functions with the same name?
C++ uses something called name mangling to export symbols with the same name. However, Rust does not currently recognize this format with extern
.
- What type of files can be linked into a Rust project?
Linked libraries can be of the form name.a
, name.lib
, name.so
, name.dylib
, name.dll
, or name.rlib
, each with their own format.