Undefined vs. Unsafe in Rust
Tl;dr;<p>Code in an unsafe block <i>may</i> generate undefined behavior if it is used incorrectly, but, if used correctly, will not.<p>Rust code which is not in an unsafe block cannot generate undefined behavior (aside from bugs in the compiler/underlying libraries).