rune icon indicating copy to clipboard operation
rune copied to clipboard

Allow to iteration over functions available in loaded source

Open ModProg opened this issue 2 years ago • 3 comments

This existed: https://docs.rs/rune/latest/rune/runtime/struct.Unit.html#method.iter_functions but I think was made private.

I'm writing a "wrapper" that allows using public functions as subcommands, I can use lookup_function to check if a function exists, but I cannot print any helpful lists of availible messages.

ModProg avatar May 30 '23 17:05 ModProg

I don't mind much making it public, but it's being changed heavily now in relation to runedoc, so it might not be suitable for public consumption in its current iteration.

You can also collect function hashes by using a visitor, like rune test and rune bench does it.

udoprog avatar May 30 '23 17:05 udoprog

Access to doc comments would be the next helpful thing, I'm not pressed on having it ASAP as I'm still very much in the beginning of my scripting tool and the happy path is working great (thanks for rune btw).

ModProg avatar May 30 '23 17:05 ModProg

You got it!

The best way to access comments consistently right now would be to at some point make doc::Context public. It provides a unified API over compiled sources and the native context.

udoprog avatar May 30 '23 17:05 udoprog