From 1620965aee10b53229af8d07466db8002d47ff8d Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Wed, 11 Dec 2013 13:51:13 -0800 Subject: [PATCH] Add get_root_as_any to _MessageReader --- capnp/lib/capnp.pyx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/capnp/lib/capnp.pyx b/capnp/lib/capnp.pyx index a1687c7..8f4bff1 100644 --- a/capnp/lib/capnp.pyx +++ b/capnp/lib/capnp.pyx @@ -2311,6 +2311,16 @@ cdef class _MessageReader: s = schema return _DynamicStructReader()._init(self.thisptr.getRootDynamicStruct(s.thisptr), self) + cpdef get_root_as_any(self) except +reraise_kj_exception: + """A method for getting a Cap'n Proto AnyPointer, from an already pre-written buffer + + Don't use this method unless you know what you're doing. + + :rtype: :class:`_DynamicObjectReader` + :return: An AnyPointer that you can read from + """ + return _DynamicObjectReader()._init(self.thisptr.getRootAnyPointer(), self) + cdef class _StreamFdMessageReader(_MessageReader): """Read a Cap'n Proto message from a file descriptor