4 ms·
Um, rust does have a runtime, that's why you don't need to include packages for strings, refcounting, allocation, etc. Anything that has a language keyword sho
by olliej 6y ago
Um, rust does have a runtime, that's why you don't need to include packages for strings, refcounting, allocation, etc.
Anything that has a language keyword should have a default implementation in that runtime, and much like box, ?, !, etc async and await are both language features that I shouldn't need to include from outside of the runtime.
- ibraheemdev 6y agoWhat the OP is probably referring to is that Rust does not have a runtime in the typical sense used by languages such as Java. Rust does have a runtime, as all non-assembly languages do, but it is very very small. Languages with minimal runtimes like C or Rust are commonly referred to as having "no runtime".
- GolDDranks 6y agoThose are all pay-as-you go features; in my mind I associate runtime with a single, constant-ish initialization cost, plus possibly some background processing or inserted hooks that do janitor work for you. Rust doesn't have a runtime in that sense.
- octoberfranklin 6y ago> you don't need to include packages for strings, refcounting, allocation, etc. Oh, but you do! These are in std::str, std::rc, and std::alloc, respectively. You're absolutely able to choose not to include these packages, with #![no_std]. That's how rust is able to target platforms like 8-bit microcontrollers with 16kbytes of RAM. https://rust-embedded.github.io/book/intro/no-std.html https://rust-embedded.github.io/book/intro/no-std.html
- mratsim 6y agoI think you are confusing a standard library with a runtime. A runtime is something you need to start before being able to use a language (typically a garbage collector, an event loop, a threadpool or a VM)