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

It's hard to return HttpServer or App<AppEntry, Body> from a function #1156

Closed
UkonnRa opened this issue Nov 6, 2019 · 11 comments
Closed

It's hard to return HttpServer or App<AppEntry, Body> from a function #1156

UkonnRa opened this issue Nov 6, 2019 · 11 comments

Comments

@UkonnRa
Copy link

UkonnRa commented Nov 6, 2019

For some reason, I have to return HttpServer from a function (say consume a Config struct and generate a HttpServer). But the type signature of HttpServer is REALLY HARD for me to return, or even possible. Tons of depending types are private.

Even worse, so as actix_Web::App. App::new will return App<AppEntry, Body>, where AppEntry is private also... So it is still impossible to return from my function...

@fafhrd91

This comment was marked as outdated.

@bitemyapp

This comment was marked as resolved.

@UkonnRa
Copy link
Author

UkonnRa commented Nov 7, 2019

Finding that actix_web::Resource, actix_web::Scope are usable. So maybe I can return there types instead

@UkonnRa UkonnRa closed this as completed Nov 7, 2019
@radix

This comment was marked as resolved.

@fafhrd91
Copy link
Member

fafhrd91 commented Jan 5, 2020

https://actix.rs/docs/application/

Configure section

@davepacheco

This comment was marked as resolved.

davepacheco added a commit to oxidecomputer/omicron that referenced this issue Feb 14, 2020
associated with the app into a separate function for use in the test
suite as well as the server program.  This didn't work.  See:
actix/actix-web#1156
@s97712
Copy link

s97712 commented Mar 15, 2020

https://actix.rs/docs/application/

Configure section

configure can't use middeware

@gbaranski
Copy link
Contributor

Make sure that you remove semicolon inside closure where you call App::new(), otherwise App won't be returned from the closure.

@ccrvlh

This comment was marked as resolved.

@davepacheco

This comment was marked as resolved.

@robjtede
Copy link
Member

Hope this from the FAQ helps future wanderers to this issue: How can I return App from a function / why is AppEntry private?

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

No branches or pull requests

9 participants