Skip to content

Commit f174495

Browse files
committed
Add default value and behaviour
1 parent d85eeec commit f174495

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Ham = msgpack:pack(Spam),
3737

3838
### `{spec, new|old}`
3939

40-
Both for packing and unpacking. Major difference between old and new spec is:
40+
Both for packing and unpacking. Default is `new`. Major difference
41+
between old and new spec is:
4142

4243
- raw family (`0xa0~0xbf`, `0xda`, `0xdb`) becomes new str family
4344
- `0xd9` is new as str8
@@ -57,18 +58,18 @@ OldHam = msgpack:pack(Spam, [{spec, old}]),
5758

5859
### `{allow_atom, none|pack}`
5960

60-
Only in packing. Atoms are packed as binaries.
61+
Only in packing. Atoms are packed as binaries. Default value is `pack`.
6162

6263
### `{known_atoms, [atom()]}`
6364

6465
Both in packing and unpacking. In packing, if an atom is in this list
6566
a binary is encoded as a binary. In unpacking, msgpacked binaries are
6667
decoded as atoms with `erlang:binary_to_existing_atom/2` with encoding
67-
`utf8`.
68+
`utf8`. Default value is an empty list.
6869

6970
### `{str, as_binary|as_list}`
7071

71-
Both in packing and unpacking. Only available at new spec.
72+
Both in packing and unpacking. Only available at new spec. Default is `as_list`.
7273

7374
This option indicates str type family is treated as binary or list in
7475
Erlang world.
@@ -97,11 +98,11 @@ Opt = [{enable_str, true}]
9798
### `{validate_string, boolean()}`
9899

99100
Both in packing and unpacking. UTF-8 validation in encoding to str and
100-
decoding from str type will be enabled.
101+
decoding from str type will be enabled. Default value is `true`.
101102

102103
### `{map_format, maps|jiffy|jsx}`
103104

104-
Both at packing and unpacking.
105+
Both at packing and unpacking. Default value is `maps`.
105106

106107
```erlang
107108
msgpack:pack(#{ <<"key">> => <<"value">> }, []).
@@ -112,7 +113,8 @@ msgpack:pack([{<<"key">>, <<"value">>}], [{format, jsx}]).
112113

113114
### `{ext, {msgpack_ext_packer(), msgpack_ext_unpacker()}|module()}`
114115

115-
At both.
116+
At both. The default behaviour in case of facing ext data at decoding
117+
is to ignore them as its length is known.
116118

117119
Now msgpack-erlang supports ext type. Now you can serialize everything
118120
with your original (de)serializer. That will enable us to handle

0 commit comments

Comments
 (0)