This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.
#lang reader (submod "racket.rkt" reader)
(require "stream.rkt" "utils.rkt")
(provide (all-defined-out))
#|
approximates
https://github.com/mbutterick/restructure/blob/master/src/Reserved.coffee
|#
(define-subclass Streamcoder (Reserved type [count 1])
(define/augment (decode stream parent)
(send stream pos (+ (· stream pos) (size #f parent)))
(void))
(define/override (size [val #f] [parent #f])
(* (send type size) (resolve-length count #f parent)))
(define/augment (encode stream val [parent #f])
(send stream fill 0 (size val parent))))