summary refs log blame commit diff stats
path: root/tests/generics/mbind_bracket.nim
blob: 4bf18b471ac80cfa89c0f90e3f9e5c2852ff7d0a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                              
import tables

type
  UUIDObject* = ref object
    uuid: string

  Registry*[T] = ref object
    objects: Table[string, T]

proc newRegistry*[T](): Registry[T] =
  result = Registry[T]()
  result.objects = initTable[string, T](128)

proc register*[T](self: Registry[T], obj: T) =
  self.objects[obj.uuid] = obj