5 ms·
Project member here. It exports stdlib types (like io::Error) where appropriate so that libraries working with these can stay compatible, so `no_std` is not re
by Argorak 7y ago
Project member here.
It exports stdlib types (like io::Error) where appropriate so that libraries working with these can stay compatible, so `no_std` is not really an option.
The underlying library (async-task) is essentially core + liballoc, just no one made the effort to spell that out, yet.
- davidhyde 7y ago> It exports stdlib types (like io::Error) Excellent, good to know!
- thethirdone 7y agoWould there be any benefit to making a `no_std` option? I can't think of a situation you would want async std and have including std be a problem.
- jeremyjh 7y agoThe benefit would be you would be making it impossible to wreck your scheduler by calling sync I/O functions in an async task.
- Argorak 7y agoI wouldn't rely on that. Next step, someone binds to a blocking database driver and you are back at square 1 again. This is definitely not rigorous. I would love to see a lint for known-blocking constructs in async contexts, though: https://github.com/rust-lang/rust-clippy/issues/4377 https://github.com/rust-lang/rust-clippy/issues/4377 Also, having explicit imports and types that name collide helps there for once.
- jeremyjh 7y agoHow would you have a blocking database library that doesn't use the standard library?
- Argorak 7y agoAny code in Rust is free to bind to FFI and sockets can be gained through `libc`.
- jeremyjh 7y agoI didn't literally mean "How is that possible?" I meant: is that a real thing? Is there a database binding out on crates.io that uses no_std ?
- pcwalton 7y agoSQLite is C code and any Rust usage of it will not play nicely with M:N. This is just off the top of my head. I'm sure there are plenty of other examples.
- Argorak 7y agoYes. E.g. some databases highly recommend using their C library, as they don't consider their protocol specified. That gap might close, but it will stay with us for years.
- khuey 7y agounsafe
- Argorak 7y agoI'm pretty sure that once you don't want `std`, you also want to pick your own scheduler. In this case, you can use the base library (`async-task`) and get started.