binary
binary copied to clipboard
Public BinaryIO protocol or codec for `nil`
Thanks for awesome library!
I need to serialize no value in some cases. For example:
(b/header :int-be
(fn header->body-codec [length]
(if (= -1 length)
codec/null
(b/blob :length length)))
"not used")
So I add null codec. But it's ugly:
;; hack
(def null
(b/compile-codec
(byte-array 0)
(constantly (byte-array 0))
(constantly nil)))
Is it possible to make public BinaryIO protocol or add nil primitive codec?