Sorry Python Programmers But You Are Missing Out On These 5 Astonishing Rust Features!

“1. Support For Inline Assembly”

Dr. Ashish Bamania
Level Up Coding
Published in
5 min readJan 28, 2024

Generated with DALL-E 3

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…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Written by Dr. Ashish Bamania

🍰 I simplify the latest advances in AI, Quantum Computing & Software Engineering for you | 📰 Subscribe to my newsletter here: https://intoai.pub

Responses (12)

What are your thoughts?

I'm ten years of pythonista now, and who is learning Rust as a second language. Python is about readability, not speed! Sometimes business logic is very complex, writing it in Python is a blessing) having those pieces in Rust for sure will double in…...

--

Hence, it avoids null reference errors by design

Everyone keeps saying this is a huge step forward in modern computing and I just giggle. Like that's neat and convenient and all that, but if that's the reason programmers are having trouble in other languages, boy-oh-boy, is the world of computer…...

--

I like (and second :;-) - I'm much more Rustacean than Pythonist) the message but you can still get the best of both worlds by integrating the 2 (what is fairly common in Python)

--