5 ms·
What makes Rust still rather inaccessible for me is the difficulty in finding «functions I can apply to an argument of type X» and «functions that return a valu
by tempodox 9y ago
What makes Rust still rather inaccessible for me is the difficulty in finding «functions I can apply to an argument of type X» and «functions that return a value of type Y» other than, “read every last bit of API doc about everything and memorize it”.
- tuukkah 9y agoThat would be what Hoogle is for Haskell: https://www.haskell.org/hoogle/ https://www.haskell.org/hoogle/ Could you start by grepping API docs?
- tempodox 9y ago> grepping API docs Of course, but that's still painfully slow and awkward. It's exactly the kind of repetitive crap we programmers are born to automate.
- fredmorcos 9y agoWhen you search in the API documentation, you will find 3 tabs at the top: "In Names", "In Parameters" and "In Return Types". Example: https://doc.rust-lang.org/std/?search=option https://doc.rust-lang.org/std/?search=option
- masklinn 9y agoThe official docs have limited support for it, if you search for i32[0] the default facet is "in names" but you can use the "in parameters" and "in return types" tabs for these. I don't know how well these handle abstract types and it's nowhere near hoogle convenience, but there you are (there were efforts to port/replicate hoogle a few years back but the few I remember seem to have been abandoned, specifying a search syntax is probably non-trivial as well given Rust's signatures are not as convenient as Haskell's there)/ [0] https://doc.rust-lang.org/std/?search=i32 https://doc.rust-lang.org/std/?search=i32