Conform CodingStrategy and EntityIdentifierGenerator to Codable

This commit is contained in:
Christian Treffs 2020-10-21 08:15:15 +02:00
parent 2333282fd4
commit 40d09a9c3b
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
2 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,7 @@
// Created by Christian Treffs on 05.08.20.
//
public protocol CodingStrategy {
public protocol CodingStrategy: Codable {
func codingKey<C>(for componentType: C.Type) -> DynamicCodingKey where C: Component
}

View File

@ -11,7 +11,7 @@
/// It also allows entity ids to be marked as unused (to be re-usable).
///
/// You should strive to keep entity ids tightly packed around `EntityIdentifier.Identifier.min` since it has an influence on the underlying memory layout.
public protocol EntityIdentifierGenerator {
public protocol EntityIdentifierGenerator: Codable {
/// Initialize the generator providing entity ids to begin with when creating new entities.
///
/// Entity ids provided should be passed to `nextId()` in last out order up until the collection is empty.
@ -101,3 +101,4 @@ public struct LinearIncrementingEntityIdGenerator: EntityIdentifierGenerator {
storage.markUnused(entityId: entityId)
}
}
extension LinearIncrementingEntityIdGenerator.Storage: Codable { }