-
-
Notifications
You must be signed in to change notification settings - Fork 11
UnorderedSparseSet
ctreffs edited this page Oct 7, 2020
·
4 revisions
An (unordered) sparse set.
public struct UnorderedSparseSet<Element, Key: Hashable & Codable>
-
Element
: the element (instance) to store. -
Key
: the unique, hashable datastructure to use as a key to retrieve an element from the sparse set.
See https://github.com/bombela/sparseset/blob/master/src/lib.rs for a reference implementation.
Equatable
, Sequence
public init()
var count: Int
var isEmpty: Bool
var first: Element?
@inlinable public func contains(_ key: Key) -> Bool
Inset an element for a given key into the set in O(1). Elements at previously set keys will be replaced.
@discardableResult public func insert(_ element: Element, at key: Key) -> Bool
- element: the element
- key: the key
true if new, false if replaced.
Get the element for the given key in O(1).
@inlinable public func get(at key: Key) -> Element?
- key: the key
the element or nil of key not found.
@inlinable public func get(unsafeAt key: Key) -> Element
Removes the element entry for given key in O(1).
@discardableResult public func remove(at key: Key) -> Element?
- key: the key
removed value or nil if key not found.
@inlinable public func removeAll(keepingCapacity: Bool = false)
public func makeIterator() -> ElementIterator
Generated at 2020-11-25T10:28:11+0000 using swift-doc 1.0.0-beta.5.
Types
- ComponentAdded
- ComponentIdentifier
- ComponentInstanceProvider
- ComponentRemoved
- ComponentSingletonProvider
- ComponentTypeProvider
- ComponentsBuilder.Context
- ComponentsBuilderPreview
- DefaultCodingStrategy
- DynamicCodingKey
- DynamicComponentProvider
- DynamicComponentProvider.Closure
- Entity
- Entity.ComponentsIterator
- EntityCreated
- EntityDestroyed
- EntityIdentifier
- EntityState
- EntityStateMachine
- Family
- Family.ComponentsIterator
- Family.EntityComponentIterator
- Family.EntityIterator
- FamilyMemberAdded
- FamilyMemberBuilderPreview
- FamilyMemberRemoved
- FamilyTraitSet
- LinearIncrementingEntityIdGenerator
- ManagedContiguousArray
- Nexus
- Nexus.EntitiesIterator
- Requires1
- Requires2
- Requires3
- Requires4
- Requires5
- Requires6
- Requires7
- Requires8
- Single
- StateComponentMapping
- StringHashing
- UnorderedSparseSet
- UnorderedSparseSet.ElementIterator
Protocols
- CodingStrategy
- Component
- ComponentProvider
- DefaultInitializable
- EntityIdentifierGenerator
- FamilyDecoding
- FamilyEncoding
- FamilyRequirementsManaging
- NexusEvent
- NexusEventDelegate
- RequiringComponents1
- RequiringComponents2
- RequiringComponents3
- RequiringComponents4
- RequiringComponents5
- RequiringComponents6
- RequiringComponents7
- RequiringComponents8
- SingleComponent
- TopLevelDecoder
- TopLevelEncoder