File tree Expand file tree Collapse file tree
packages/polywrap-msgpack Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # polywrap-msgpack
2+
3+ Python implementation of the WRAP MsgPack encoding standard.
4+
5+ ## Usage
6+
7+ ### Encoding-Decoding Native types and objects
8+
9+ ``` python
10+ from polywrap_msgpack import msgpack_decode, msgpack_encode
11+
12+ dictionary = {
13+ " foo" : 5 ,
14+ " bar" : [True , False ],
15+ " baz" : {
16+ " prop" : " value"
17+ }
18+ }
19+
20+ encoded = msgpack_encode(dictionary)
21+ decoded = msgpack_decode(encoded)
22+
23+ assert dictionary == decoded
24+ ```
25+
26+ ### Encoding-Decoding Extension types
27+
28+ ``` python
29+ from polywrap_msgpack import msgpack_decode, msgpack_encode, GenericMap
30+
31+ counter: GenericMap[str , int ] = GenericMap({
32+ " a" : 3 ,
33+ " b" : 2 ,
34+ " c" : 5
35+ })
36+
37+ encoded = msgpack_encode(counter)
38+ decoded = msgpack_decode(encoded)
39+
40+ assert counter == decoded
41+ ```
You can’t perform that action at this time.
0 commit comments