Skip to content

Commit e76bb7d

Browse files
committed
feat: add readme for polywrap-msgpack
1 parent 95f0fa7 commit e76bb7d

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
```

0 commit comments

Comments
 (0)