Skip to content
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

GrpcMethod's service and method should have "static" lifetime? #1547

Open
sneakstarberry opened this issue Oct 9, 2023 · 1 comment · May be fixed by #1598
Open

GrpcMethod's service and method should have "static" lifetime? #1547

sneakstarberry opened this issue Oct 9, 2023 · 1 comment · May be fixed by #1598

Comments

@sneakstarberry
Copy link

Feature Request

Crates

extensions::GrpcMethod

Motivation

I'm currently create dynamic client but if create GrpcMethod struct with &'static str then there is a memory leak occur. so I want to avoid this happen.

Proposal

Actually, this is not proposal. it's a question.
In client side generated code, GrpcMethod created with &'static str, but is it necessary?
if it's necessary one then, can you explain it for me? and there is a way to avoid this?
thank you in advance.

req.extensions_mut()
    .insert(GrpcMethod::new("helloworld.Greeter", "SayHelloBidiStream"));

----

#[derive(Debug, Clone)]
pub struct GrpcMethod {
    service: &'static str,
    method: &'static str,
}

Alternatives

@tottoto
Copy link
Contributor

tottoto commented Jan 9, 2024

As GrpcMethod technically seems not to need to be static, it might be allowed to have an arbitrary lifetime.

@tottoto tottoto linked a pull request Jan 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants