Native deserialization based on Rust and PyO3
Proof of concept Only capable of deserializing (nested) Messages with primitive fields No handling of lists, maps, enums, .. implemented yet See `example.py` for a working example
This commit is contained in:
@@ -779,6 +779,7 @@ class Message(ABC):
|
||||
"""
|
||||
Get the binary encoded Protobuf representation of this message instance.
|
||||
"""
|
||||
|
||||
output = bytearray()
|
||||
for field_name, meta in self._betterproto.meta_by_field_name.items():
|
||||
try:
|
||||
@@ -1002,6 +1003,14 @@ class Message(ABC):
|
||||
:class:`Message`
|
||||
The initialized message.
|
||||
"""
|
||||
|
||||
if True:
|
||||
# TODO: Make native deserialization optional
|
||||
|
||||
import betterproto_extras
|
||||
betterproto_extras.deserialize(self, data)
|
||||
return self
|
||||
|
||||
# Got some data over the wire
|
||||
self._serialized_on_wire = True
|
||||
proto_meta = self._betterproto
|
||||
|
||||
Reference in New Issue
Block a user