← Back

Rust for Rubyist

I'm learning basic Rust. As a veteran Rubyist with OOP skill, Rust is like another world to me. So I'll try to list the key differences and terminalogies in each language side by side.

Class/ModuleType/TraitTraits are more like Interfaces
-MacrosRuby has Metaprogramming, but I don't think it's the same.
print "#{var}"println!("{}", var)Does Rust have string interpolation within quotes?
StringChar / String / String Slices
#//Comments in Rust are like in JavaScript/C
ArrayArray / VectorArray in Rust mostly be immutable, Vector can be mutable with mut
nilOption<Some, None>I like the Option thing in Rust
case whenmatchBetter pattern matching in Rust!
block { |x| x }closure ( |x| x )
No semicolonsSemicolons (almost)
Duck TypingStatic TypingWait for Ruby 3!

I will add more when I read all essential docs and start making something with Rust.

(This page is still work in progress)