where we can call the name/args/output the signature of the function.
In C like languages, we have .h/.cpp separation, where one has the signature, and the other contains the body/implementation.
In Rust, on some classes with too many long functions, I'd like a way to only specify the type signature (a Table of Contents of sort), and then use jump-to-def to jump to the body/impl.
Is there any way to do this in Rust? One solution is to create a useless trait, where the trait body would contain just the signatures, and the "impl trait for ... " would contain the actual body; but this seems a bit silly.
How about folding all the function bodies? Many editors and IDEs will let you do this, through the appropriate Rust plugin or rust-analyzer or whatever.
Navigation: I find easier to jump around in IntelliJ than in a web browser.
Editing: With IntelliJ, I can editor where the cursor is. With browser, I have to then find the corresponding location in IntelliJ.
Maybe you already know this, but in IntelliJ there are two ways to get all the types and functions in a file.
(The following shortcuts are based on my mac setup YMMV):
Command + F12 :: brings up the "Main Menu -> Navigate -> File Structure" shortcut modal which has a list of top level constants, traits, and functions with instant type-to-search.
Command + 7 :: Use the persistent version of (1) by bringing up the "Structure" view: "Top menu -> View -> Tool Windows -> Structure"
I wish there was similar functionality for the module / crate level but I don't think it exists yet.
This is pretty cool. I'm also using IdeaVIM. If there was only a way I could navigate this with vim keys "hjkl, /search" ... Ideally some hot key lets me swap between
edit current file
read only view of 'file' that represents this 'tool windows -> structure'