-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codegen with Arc<dyn ..>
instead of Arc<Box<..>>
#234
Comments
Xynnn007
added a commit
to Xynnn007/ttrpc-rust
that referenced
this issue
Aug 19, 2024
This commit changes the generated ttrpc server from Arc<Box<T>> to Arc<T>. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes containerd#234 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Xynnn007
added a commit
to Xynnn007/ttrpc-rust
that referenced
this issue
Aug 19, 2024
This commit changes the generated ttrpc server from Arc<Box<T>> to Arc<T>. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes containerd#234 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Xynnn007
added a commit
to Xynnn007/ttrpc-rust
that referenced
this issue
Aug 19, 2024
This commit changes the generated ttrpc server from Arc<Box<T>> to Arc<T>. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes containerd#234 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Xynnn007
added a commit
to Xynnn007/ttrpc-rust
that referenced
this issue
Aug 19, 2024
This commit changes the generated ttrpc server from Arc<Box<T>> to Arc<T>. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes containerd#234 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Xynnn007
added a commit
to Xynnn007/ttrpc-rust
that referenced
this issue
Aug 20, 2024
This commit changes the generated ttrpc server from Arc<Box<T>> to Arc<T>. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes containerd#234 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
jokemanfire
pushed a commit
to jokemanfire/ttrpc-rust
that referenced
this issue
Sep 27, 2024
This commit changes the generated ttrpc server from Arc<Box<T>> to Arc<T>. This helps the type conversion and also avoids extra runtime cost caused by double pointer. Fixes containerd#234 Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I am using ttrpc for some time. One thing confused me is that with ttrpc's
Codegen
, we would generate a.._ttrpc.rs
where aXXXMethod
would have aservice
member with typeArc<Box<dyn ...>>
rather thanArc<dyn ...>
.I wonder if we could convert
Arc<Box<dyn ...>>
toArc<dyn ...>
?The reason comes from some ttrpc server implementation.
We are using a proto with more-than-one Service, e.g.
We want that a same object would serve the two APIs, thus we have
So what we can do is only to create two
Server
s to create different services, which means double the memory consumption.If the ttrpc CodeGen returns type
Arc<dyn T>
, we can facilitate bywhere the
as _
would help the compiler convertArc<Server>
toArc<dyn A>
andArc<dyn B>
.The text was updated successfully, but these errors were encountered: