1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-12-23 23:12:52 +02:00

Publish Comprehensive Rust 🦀

This commit is contained in:
Martin Geisler
2022-12-21 16:36:30 +01:00
commit c212a473ba
252 changed files with 8047 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# Calling External Code
Functions from other languages might violate the guarantees of Rust. Calling
them is thus unsafe:
```rust,editable
extern "C" {
fn abs(input: i32) -> i32;
}
fn main() {
unsafe {
// Undefined behavior if abs misbehaves.
println!("Absolute value of -3 according to C: {}", abs(-3));
}
}
```