Porting Go to Rust

Notes from real port effort

Personal project to port FIX protocol trading engine from Go (https://github.com/quickfixgo/quickfix)

to Rust (https://github.com/fixer-rs/)

 

I'm Karuna Murti

LinkedIn: https://www.linkedin.com/in/karunamurti/

Background

The basics

Data types

Rust: i8, u8, i16, u16, i32, u32, i64, u64, i128, u128, isize, usize, f32, f64
Go: int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, float32, float64

 

Rust: String, &'str
Go: string

 

Rust: bool

Go: bool

Containers

Rust: [T; N] (array), Vec<T> (vector), &[T] (slices)

Go: [N]T (array), []T (slices)

 

Rust: std::collections::hash_map::HashMap<K, V>

Go: map[K]V

 

Rust: Vec<u8>

Go: []byte

Flow of control

Rust: if n == 5 {

} else if n == 3 {

} else {

}

 

Go: if n == 5 {

} else if n == 3 {

} else {

}

 

Both has no ternary

Flow of control

Rust:

 

 

Porting Go to Rust

By Karuna Murti