4 ms·
This might be useful https://doc.rust-lang.org/reference/tokens.html#punctuation https://doc.rust-lang.org/reference/tokens.html#punctuation
by rascul 2y ago
This might be useful
https://doc.rust-lang.org/reference/tokens.html#punctuation https://doc.rust-lang.org/reference/tokens.html#punctuation
- yencabulator 2y agoThat doesn't seem to explain 'lifetimes or turbo::<Fish>, though.
- steveklabnik 2y agoThe page linked for :: explains the turbofish. That said, you're right that it could use a row for the lifetime syntax.
- yencabulator 2y agoIf you know where to look, you will find it. If you don't, you don't. For someone new to Rust, I don't see why you'd expect them to expect to see a "path separator" between the function name and it's call in x.collect::<Vec<_>>(). A more likely path to discovery is via the Generics link (discovered from "<" being so prominent there), which shows the ::<> syntax in context of const values, and that isn't actually very helpful for understanding.
- steveklabnik 2y agoSo the thing is, the link provided is not really intended to be "teach me what syntax means." It is meant to provide a reference for various tokens. And it does that, because the turbofish isn't a single thing, it's a combination of two things. If the goal of this page was "comprehensively explain Rust syntax to someone who doesn't know Rust," I would agree with you. But it's "produce a spec-like document for experts who want fine-grained details about the language."