luaur_ast/records/position.rs
1//! Faithful port of Luau `Position` (`Ast/include/Luau/Location.h`).
2//!
3//! `unsigned int line, column`. C++ `operator<` orders by line then column,
4//! which is exactly what the derived `Ord` does over the fields in declaration
5//! order — so the six comparison operators (`==`, `!=`, `<`, `<=`, `>`, `>=`)
6//! collapse into the derives here, and their separate method items stay stubs.
7//! `Default` is `(0, 0)`, matching the `Position(0, 0)` used by `Location()`.
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
10pub struct Position {
11 pub line: u32,
12 pub column: u32,
13}
14
15// `Position::missing()` (the `{UINT_MAX, UINT_MAX}` sentinel) is its own
16// one-item-per-file method, `methods/position_missing.rs`.