Sorry Python Programmers But You Are Missing Out On These 5 Astonishing Rust Features!
“1. Support For Inline Assembly”
Python is great but Rust introduces a completely new and different paradigm in computer programming and writing stable applications.
No doubt, all major tech companies are moving towards it.
These are the 5 features in Rust that Python programmers are completely new to.
1. Support For Inline Assembly
Rust supports inline assembly written in the following architectures:
- x86 and x86–64
- ARM
- AArch64
- RISC-V
- LoongArch
Inline assembly can be written in your code using theasm!
and global_asm!
macros.
These macros embed handwritten assembly in the assembly output generated by the compiler.
Look at this example that uses inline assembly to multiply two numbers.
use std::arch::asm;
fn asm_multiply(a: u64, b: u64) -> u64 {
let mut result: u64;
unsafe {
asm!(
"mov rax, {0}",
"mul {1}",
in(reg) a,
in(reg) b,
lateout("rax") result…