9.0
top
← prev up next →

MessagePackπŸ”— i

Bogdan Popa <bogdan@defn.io>

This module provides an implementation of the MessagePack serialization format. Data is converted between MessagePack and Racket according to the following table:

MsgPack Type

Racket Contract

bool

boolean?

int

(integer-in (- (expt 263))(sub1 (expt 264)))

float

real?

bin

bytes?

string

string?

array

list?

map

hash?

timestamp

date*?

When serializing integer values to MessagePack, the library chooses the shortest representation available.

procedure

( msgpack-nil? v)boolean?

v:any/c
The value used to represent nil and its predicate.

procedure

( read-msgpack in)any/c

Reads a MessagePack-encoded value from in. This implementation doesn’t do anything to protect against maliciously-constructed data, so care must be taken when reading data from untrusted sources.

Extensions may be handled by parameterizing current-msgpack-ext-read-handler .

procedure

( write-msgpack v[out])void?

v:any/c
Writes v to out as MessagePack-encoded data.

Extensions may be handled by parameterizing current-msgpack-ext-write-handler .

(-> (integer-in 0127)bytes? any/c )
handler:(-> (integer-in 0127)bytes? any/c )
= #f
Holds the procedure that is used to read application-specific data. The first argument is the type tag and the second is the encoded value.

The default implementation raises an exception when called.

handler:(-> any/c (values (integer-in 0127)bytes? ))
= #f
Holds the procedure that is used to write application-specific data. The argument is the value to encode and the result values are the desired type tag and the value encoded as bytes, respectively.

The default implementation raises an exception when called.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /