disk: Entity types must implement Clone()
All disk.Entitity types now implement Clone() which should return a deep copy of the same object. Add the Clone() method to the entity interface. The return type is Entity, but callers can assume it's safe to convert back to the original type. Co-Authored-By: Christian Kellner <christian@kellner.me>
This commit is contained in:
parent
01d922a4d5
commit
221cdedebc
8 changed files with 158 additions and 24 deletions
|
|
@ -35,6 +35,9 @@ type Entity interface {
|
|||
// IsContainer indicates if the implementing type can
|
||||
// contain any other entities.
|
||||
IsContainer() bool
|
||||
|
||||
// Clone returns a deep copy of the entity.
|
||||
Clone() Entity
|
||||
}
|
||||
|
||||
// Container is the interface for entities that can contain other entities.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue