LazyWriter
Source code in src/msglc/writer.py
__init__(buffer_or_path, packer=None)
It is possible to provide a custom packer object to be used for packing the object.
However, this packer must be compatible with the msgpack
packer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buffer_or_path
|
str | BufferWriter
|
target buffer or file path |
required |
packer
|
Packer
|
packer object to be used for packing the object |
None
|
Source code in src/msglc/writer.py
write(obj)
This function is used to write the object to the file.
Only one write is allowed. The function raises a ValueError
if it is called more than once.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
the object to be written to the file |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Raises:
Type | Description |
---|---|
ValueError
|
if the function is called more than once |