|(require cbor)||package: cbor|
This library implements serialization and deserialization routines for Concise Binary Object Representation (CBOR), as defined in RFC 8949. The library takes in raw data in the form of Racket data structures, outputting a serialized binary stream, and vice versa.
config : v : any/c out : output-port? = (current-output-port)
Integers between -264 and 264 - 1, inclusive
#f and #t
Values equal? to the value of ( config)
Lists and vectors of any item accepted by cbor-write
Sequences of any item accepted by cbor-write
Hashes of items accepted by cbor-write (both the key and value)
Instances of cbor-tag
Instances of cbor-simple-value
TODO: Any value for which a tag serializer procedure is registered in config
Major type 0 (unsigned integer) and 1 (negative integer) are decoded as standard Racket integers
Major type 4 (list) is decoded as a Racket list? of the contained values
Major type 5 (map) is decoded as a Racket hash-equal? of the contained key-value pairs
Major type 6 (tag) is decoded as a cbor-tag. TODO detail custom deserializers
Major type 7, additional data 20, 21, and 23 (false, true, and undefined) are decoded as #f, #t, and undefined, respectively
Major type 7, additional data 22 is decoded as the value of ( config)
Major type 7, additional data 25, 26, and 27 (half float, single float, and double float, respectively), are all decoded as Racket flonum?. Note that this library decodes all of these three types to Racket’s double-width floating point type.
#:extra-constructor-name make-cbor-tag) number : cbor-valid-tag-number? content : any/c
(struct cbor-simple-value (inner) #:extra-constructor-name make-cbor-simple-value) inner : cbor-unassigned-simple-value?