inspect rust traits at runtime

579 views Asked by At

is there a way to inpect the traits an object provides at runtime. Similar to pythons dir()? I wish to inspect the contents of a core::str::StrSplits<'_> and would like to be able to view the traits it implements.

1

There are 1 answers

0
Chris Morgan On BEST ANSWER

There is no facility for doing this at runtime; at compile time, however, there is, and this is what rustdoc does.

With that you can see things like the core::str::StrSplits documentation which covers the information you requested.