How to introspect all available methods and members of a Rust type?
<p>Is there a way to print out a complete list of available members of a type or instance in Rust?</p>

<p>For example:</p>

<ul>
<li>In Python, I can use <code>print(dir(object))</code></li>
<li>In C, Clang has a Python API that can parse C code and introspect it.</li>
</ul>

<p>Being unfamiliar with Rust tools, I'm interested to know if there is some way to do this, either at run-time or compile-time, either with compiler features (macros for example), or using external tools.</p>

<p>This question is intentionally broad because the exact method isn't important. It is common in any language to want to find all of a variable's methods/functions. Not knowing Rust well, I'm not limiting the question to specific methods for discovery.</p>

<p>The reason I don't define the exact method is that I assume IDEs will need this information, so there will need to be some kinds of introspection available to support this (eventually). For all I know, Rust has something similar.</p>

<p>I don't think this is a duplicate of <a href="https://stackoverflow.com/q/29986057/155423">Get fields of a struct type in a macro</a> since this answer could include use of external tools (not necessarily macros).</p>