mirror of
https://github.com/apple/swift-collections
synced 2026-11-24 04:27:53 +00:00
36 lines
1.1 KiB
Swift
36 lines
1.1 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift Collections open source project
|
|
//
|
|
// Copyright (c) 2019 - 2020 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
protocol MapNode : Node {
|
|
associatedtype Key : Hashable
|
|
associatedtype Value
|
|
|
|
func get(_ key: Key, _ hash: Int, _ shift: Int) -> Value?
|
|
|
|
func containsKey(_ key: Key, _ hash: Int, _ shift: Int) -> Bool
|
|
|
|
func updated(_ key: Key, _ value: Value, _ hash: Int, _ shift: Int, _ effect: inout MapEffect) -> ReturnNode
|
|
|
|
func removed(_ key: Key, _ hash: Int, _ shift: Int, _ effect: inout MapEffect) -> ReturnNode
|
|
|
|
var hasNodes: Bool { get }
|
|
|
|
var nodeArity: Int { get }
|
|
|
|
func getNode(_ index: Int) -> ReturnNode
|
|
|
|
var hasPayload: Bool { get }
|
|
|
|
var payloadArity: Int { get }
|
|
|
|
func getPayload(_ index: Int) -> ReturnPayload /* (Key, Value) */
|
|
}
|