Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- type Array
- type BytesKey
- type Hasher
- type Map
- func (p *Map[K, V]) ContainsKey(key K) bool
- func (p *Map[K, V]) Get(key K) (V, bool)
- func (p *Map[K, V]) Insert(key K, value V) bool
- func (p *Map[K, V]) KeyValues() iter.Iterator[util.Pair[K, V]]
- func (p *Map[K, V]) MaxBucket() uint
- func (p *Map[K, V]) Size() uint
- func (p *Map[K, V]) String() string
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array[F Hasher[F]] struct { // contains filtered or unexported fields }
Array provides a mechanism for hashing hashes (or other uint64 values).
type BytesKey ¶
type BytesKey struct {
// contains filtered or unexported fields
}
BytesKey wraps a bytes array as something which can be safely placed into a HashSet.
type Hasher ¶
type Hasher[T any] interface { // Check whether two items are equal (or not). Equals(T) bool // Return a suitable hashcode. Hash() uint64 }
Hasher provides a generic definition of a hashing function suitable for use within the hashset. This is similar to the Hasher interface provided in go-set, except that it additionally includes equality.
type Map ¶
Map defines a generic set implementation backed by a map. This is a true hashtable in that collisions are handle gracefully using buckets, rather than simply discarding them.
func (*Map[K, V]) ContainsKey ¶
ContainsKey checks whether the given item is contained within this map, or not.
func (*Map[K, V]) Insert ¶
Insert a new item into this map, returning true if it was already contained and false otherwise.
func (*Map[K, V]) KeyValues ¶
KeyValues returns the set of all key-value pairs stored in this hash map. Observe that the order in which elements are seen is unspecified.
type Set ¶
type Set[T Hasher[T]] struct { // contains filtered or unexported fields }
Set defines a generic set implementation backed by a map. This is a true hashtable in that collisions are handle gracefully using buckets, rather than simply discarding them.
func (*Set[T]) Contains ¶
Contains checks whether the given item is contained within this map, or not.
func (*Set[T]) Insert ¶
Insert a new item into this map, returning true if it was already contained and false otherwise.