-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Reduce lifetime requirements of serve
.
#1669
Comments
Part of the requirement for |
I understand, but doesn't Hm, is there a safe way to hand out a reference, because the application itself isn't dropped until after the runtime is killed? |
Yea, I see what you mean. Maybe something could be done in tokio. The function |
As far as I know the problem of Through I think at last theoretically Anyway I don't think this will be possible anytime soon. |
Any update on this? |
this is driving me crazy. is there a way to do this. I have a database client and I want to use it but this doesn't let me. I tried Box::leak, mem::transmute. Nothing is working. |
I took a look at things tokio provides for handling non block_onAppears in three places Doesn't require neither of Only returns from the function call once the future completed. Must drive the future exclusively on the current thread. As neither Drawbacks
run_untilOnly supported by Doesn't require neither of Is similar to Only "continues" the calling async fn when the future completes. Drawbacks
|
Sadly there is no single method which allows non It is possible to combine futures with But as |
Currently the
NewService
trait, and a lot of the other parameters forserve
require a'static
lifetime.I'm a bit of a Rust rookie, but wouldn't it be better to tie it to the server itself?
As it stands, there's no safe way to do something like:
(Where
self
is some managed state)I can't take a reference to
self
, because the lifetime is static.Even though, the server is started on the next line, and it blocks.
So, once it gets to the end of this method, the server would have already stopped.
The text was updated successfully, but these errors were encountered: