Dedicated Coordinate struct or coordinates as args?
⚓ Rust 📅 2026-06-05 👤 surdeus 👁️ 3For some context, I wrote a semi-functional chess engine in Python, and I'm learning Rust by porting it over. The functions in the Python project that operated on locations took the coordinates as different arguments, like: def __init__(self, from_col: str, from_row: int, to_col: str, to_row: int ...
However, I could alternatively use a Coordinate struct:
pub struct Coordinate {
pub(crate) row: usize,
pub(crate) col: char,
}
Which would be better in your view?
3 posts - 2 participants
🏷️ Rust_feed