OxL Справочник OxL
РусскийEnglish

interface Hash

Types that can be keys of a Map or elements of a Set (@derive(Eq, Hash)).

Example:

oxl✓ проверяется в CI
@derive(Eq, Hash)
data Cell { row: i32; col: i32 }

fn main() io {
  var visited: Set<Cell> = Set.new()
  visited.insert(Cell{ row: 1, col: 2 })
  print("{visited.contains(Cell{ row: 1, col: 2 })} {visited.contains(Cell{ row: 2, col: 1 })}")
}
Вывод
true false
pub(api) interface Hash

С версии. 1.0.0-beta

Определено в: std/core/types.oxl:883

См. также