From fb8a3d8ac2622ee13e10c502eb00b23219dfb4aa Mon Sep 17 00:00:00 2001 From: Constantine Vetoshev Date: Fri, 24 Jun 2016 13:27:21 -0700 Subject: [PATCH] Add docstrings to (de)serialization functions. --- capnp/lib/capnp.pyx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/capnp/lib/capnp.pyx b/capnp/lib/capnp.pyx index bc8c99b..263515d 100644 --- a/capnp/lib/capnp.pyx +++ b/capnp/lib/capnp.pyx @@ -1193,6 +1193,14 @@ cdef class _DynamicStructBuilder: return ret cpdef to_segments(_DynamicStructBuilder self) except +reraise_kj_exception: + """Returns the struct's containing message as a Python list of Python bytes objects. + + This avoids making copies. + + NB: This is not currently supported on PyPy. + + :rtype: list + """ self._check_write() cdef _MessageBuilder builder = self._parent segments = builder.get_segments_for_output() @@ -2996,6 +3004,14 @@ class _StructModule(object): message = _FlatArrayMessageReader(buf, traversal_limit_in_words, nesting_limit) return message.get_root(self.schema) def from_segments(self, segments, traversal_limit_in_words = None, nesting_limit = None): + """Returns a Reader for a list of segment bytes. + + This avoids making copies. + + NB: This is not currently supported on PyPy. + + :rtype: list + """ message = _SegmentArrayMessageReader(segments, traversal_limit_in_words, nesting_limit) return message.get_root(self.schema) def from_bytes_packed(self, buf, traversal_limit_in_words = None, nesting_limit = None):