Skip to content

Commit 7011e72

Browse files
add docs for z_serialize and z_deserialize functions (#531)
* add docs for z_serialize and z_deserialize functions * add zenoh.ext to docs index
1 parent 1b23233 commit 7011e72

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import tomllib
2727

2828
import zenoh
29+
import zenoh.ext
2930

3031
# -- Project information -----------------------------------------------------
3132

docs/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,10 @@ module zenoh.handlers
7474
.. automodule:: zenoh.handlers
7575
:members:
7676
:undoc-members:
77+
78+
module zenoh.ext
79+
================
80+
81+
.. automodule:: zenoh.ext
82+
:members:
83+
:undoc-members:

zenoh/ext.pyi

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,28 @@ class Float64(float):
4343
class ZDeserializeError(Exception):
4444
pass
4545

46-
def z_serialize(obj: Any) -> ZBytes: ...
47-
def z_deserialize(tp: type[_T], zbytes: ZBytes) -> _T: ...
46+
def z_serialize(obj: Any) -> ZBytes:
47+
"""Serialize an object of supported type according to the `Zenoh serialization format <https://github.com/eclipse-zenoh/roadmap/blob/main/rfcs/ALL/Serialization.md>`_.
48+
49+
Supported types are:
50+
51+
* UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool;
52+
53+
* Str, Bytes, ByteArray;
54+
55+
* List, Dict, Set, FrozenSet and Tuple of supported types.
56+
"""
57+
pass
58+
59+
def z_deserialize(tp: type[_T], zbytes: ZBytes) -> _T:
60+
"""Deserialize into an object of supported type according to the `Zenoh serialization format <https://github.com/eclipse-zenoh/roadmap/blob/main/rfcs/ALL/Serialization.md>`_.
61+
62+
Supported types are:
63+
64+
* UInt8, UInt16, Uint32, UInt64, UInt128, Int8, Int16, Int32, Int64, Int128, int (handled as int32), Float32, Float64, float (handled as Float64), bool;
65+
66+
* Str, Bytes, ByteArray;
67+
68+
* List, Dict, Set, FrozenSet and Tuple of supported types.
69+
"""
70+
pass

0 commit comments

Comments
 (0)