Skip to content

Commit 99f5db1

Browse files
update docs
1 parent 5cc8056 commit 99f5db1

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

docs/pages/pydsdl.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,11 @@ You can find a practical usage example in the Nunavut code generation library th
1515
The main functions
1616
++++++++++++++++++
1717

18-
DSDL parsing frint-end:
19-
2018
.. autofunction:: pydsdl.read_namespace
2119
.. autofunction:: pydsdl.read_files
22-
23-
Data (de)serialization:
24-
2520
.. autofunction:: pydsdl.serialize
2621
.. autofunction:: pydsdl.deserialize
2722

28-
See ``demo/demo_serdes.py`` for a complete working example.
29-
3023

3124
Type model
3225
++++++++++

pydsdl/_serdes.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ def serialize(schema: CompositeType, obj: _Obj, *, with_delimiter_header: bool =
9090
:raises SerDesError: If serialization fails.
9191
:raises TypeError: If schema is a ServiceType.
9292
:raises ValueError: If with_delimiter_header=True on a non-delimited type.
93+
94+
.. rubric:: Usage demo
95+
96+
.. literalinclude:: ../../demo/DemoMessage.1.0.dsdl
97+
:language: python
98+
:caption: demo/DemoMessage.1.0.dsdl
99+
100+
.. literalinclude:: ../../demo/demo_serdes.py
101+
:language: python
102+
:caption: demo/demo_serdes.py
93103
"""
94104
# Reject ServiceType
95105
if isinstance(schema, ServiceType):
@@ -132,7 +142,7 @@ def deserialize(
132142
schema: CompositeType, data: bytes | bytearray | memoryview, *, with_delimiter_header: bool = False
133143
) -> _Obj:
134144
"""
135-
Deserialize bytes to a Python object according to the given schema.
145+
The counterpart of :func:`pydsdl.serialize`.
136146
137147
:param schema: The composite type schema defining the structure.
138148
:param data: The bytes to deserialize.

0 commit comments

Comments
 (0)