|
|
|
@ -50,6 +50,9 @@ https://github.com/mbutterick/restructure/blob/master/src/Struct.coffee
|
|
|
|
|
(super-new)
|
|
|
|
|
(init-field [(@fields fields)])
|
|
|
|
|
|
|
|
|
|
(when @fields (unless (dict? @fields)
|
|
|
|
|
(raise-argument-error '+xstruct "dict" @fields)))
|
|
|
|
|
|
|
|
|
|
(define/augride (xxdecode port parent [len 0])
|
|
|
|
|
;; xstruct-setup and xstruct-parse-fields are separate to cooperate with VersionedStruct
|
|
|
|
|
(define decoded-hash
|
|
|
|
@ -100,8 +103,6 @@ https://github.com/mbutterick/restructure/blob/master/src/Struct.coffee
|
|
|
|
|
(unless (symbol? (car kv))
|
|
|
|
|
(raise-argument-error '+xstruct "symbol" (car kv)))
|
|
|
|
|
(apply cons kv)))
|
|
|
|
|
(unless (dict? fields)
|
|
|
|
|
(raise-argument-error '+xstruct "dict" fields))
|
|
|
|
|
(new class [fields fields]))
|
|
|
|
|
|
|
|
|
|
(module+ test
|
|
|
|
|