Comments (4)
actix_rt::spawn
also comes up a lot with those new to async. Many jump to tokio::spawn
instead of using actix_rt
, and spawning tasks doesn't seem to be covered anywhere in the docs. It might also be useful to re-export it under web::spawn
similar to web::block
.
I think this points to a broader issue with people assuming that actix-web "just uses tokio", and that all tokio runtime methods should "just work". !Send
futures and the ability to use Rc
instead of Arc
, etc. is also relevant. A runtime section in the docs would probably help.
from actix-website.
We should add a note to explain what's actix-rt
in brief here. Indeed, it's user-friendly if we have an explanation to add actix-rt
to dependencies at least.
from actix-website.
Adding an explanation/instruction to add to dependencies would have eliminated my steps 1-4 for sure. My guess is I would not have opened this issue had that been the case. Personal views on what makes for a great tutorial aside, I think that's a strong candidate for "easiest plan to productively close the issue".
If taking my personal views into account, this explanation feels to me like might be introducing actix-rt
in a way that abstracts it a bit too much. This would makes sense for some things (such as abstracting away the inner details of printf(3)
when first learning C
), but I'm not so sure actix-rt
is so clear cut. As a 100% newbie, I might be left thinking "this is a new thing. It seems pretty important. It looks like I will have to deal with it in some detail. I need to know more than just 'add it to dependancies'". The effect on me would be to get distracted from the learning-task at hand (not always a bad thing).
Taking that into consideration, something like a link, comment-box, footnote, etc. to briefly explain the role actix-rt
plays in the context of /docs/server content, and a promise to the reader that it's covered in later chapters. That way they can "learn only as much as they need to right now, but know where to go for something more in-depth". Without knowing much about actix
or actix-rt
, I can't comment on what would make a good balance when it comes to how much detail actix-rt
needs when being introduced.
from actix-website.
@ibraheemdev
"just use tokio" is a path we are taking and more. Take a look at this PR and it's already ready.
actix/actix-net#266 (comment)
I believe we should let user use whatever runtime they want as more as possible and not limiting them to a strict model. (This would not happen right away with a single PR but a general direction we would want to work on).
The problem about !Send
is legit as it has not only to do with cost but also compiler issue. (Liking trying to use awc
or actix
inside tokio::spawn).
I guess the solution could be we mirror tokio
when we can and try to support most tokio types/features when we can.
At the same time we want to keep the compat to already established actix-*
eco. Documentation should be more specific on the part where a confustion may happen. (Like the awc example mentioned above).
There is a downside with this approach that would be the code base would be more complicated an could give trouble for future maintainers. But in general I believe the async Rust is heading towards a reduction of runtime fragmentation so the task would mostly be removing runtime related code and not adding more to it.
TLDR: we could make actix_rt
stuff an opt-in like feature. It's there and if it's already used it's just like that. We encourage new comers to use whatever they like and only when they try to use actix-*
crates in a specific way and/or after high perf/low overhead we guide them to use actix_rt
(or counterpart of the same runtime feature of something like tokio
, async_std
)
from actix-website.
Related Issues (20)
- Can't compile either static file example HOT 2
- Getting started: Indicate that the example code should be written in src/main.rs
- HTTP/2 support works with rustls, docs may be outdated HOT 1
- please preserve my eyesight and add a dark mode HOT 1
- Dangerous tip in Static Files
- ^^ the trait `Responder` is not implemented for `NamedFile` HOT 1
- Broken links HOT 3
- request monospace font HOT 2
- Outdated info in Server section HOT 1
- ACTIX WEB HTTP2 & OPENSSL : not working exact example from actix.rs website HOT 2
- invalid link to match_info in docs HOT 2
- Actix book link broken HOT 1
- Invalid Link in Extractors Tab (in Docs)
- Chunked body request example does not render on website HOT 1
- The `connection_type` method should not be called on `HttpResponseBuilder` instance. HOT 1
- Search functionality HOT 1
- Add more complex middleware example
- Testing example doesn't work HOT 3
- update docusaurus to v3
- Rendering issue with `warning` fence in `static-files.md`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actix-website.