Hi Joe,

Check out this utility class OwnCapnp<T> from the Sandstorm codebase:

https://github.com/sandstorm-io/sandstorm/blob/4d86a8144cdb43120ea12845738d0fe4a6ffcda1/src/sandstorm/util.h#L495-L525

I really need to move this utility class into the Cap'n Proto library at
some point...

-Kenton

On Fri, May 3, 2019 at 9:44 AM Joe Ludwig <[email protected]> wrote:

> Image this schema:
>
> interface MyThing
> {
>  setFoo @0 ( newFoo : Foo ) -> ( success: Bool );
> }
>
>
> interface MyServer
> {
>  getAllTheFoos @0 () -> (foos: List(Foo));
> }
>
>
>
> My setFoo implementation gets a Foo::Reader from its parameters.  I'd like
> to hang onto that reader and then return  that same data on response to the
> getAllTheFoos call on another object on the same server. I understand that
> a copy will likely need to be made because the client calling setFoo may
> not be the same as the client calling getAllTheFoos, so the underlying
> transport might be different.
>
> Is there some way to "convert" the Foo::Reader I have into a Foo::Builder
> (or list of Foo::Builder)? I could do that by hand, obviously, but that'll
> be annoying to maintain.
>
>
> Joe
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/group/capnproto.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to