pub fn declaration<T>() -> Option<DeclarationSite>Expand description
Attempt to get the declaration site of the function item type of the
given type, using its type name. In most cases, you may want to use
declaration_of, since function item types are unnameable.
This function uses declaration_by_name with the type
name of the type parameter T.
This will (probably) return None for non-function item types.
See also “Caveats” in the module level documentation.
Note: This could be a feature provided by core::any (using a new
intrinsic, returning &'static Location<'static>).
However, that (currently) doesn’t exist. If it did, it would be:
- significantly faster
- more correct for functions as it would provide a column.
- support e.g. structs, unions
- not able to be run dynamically as
declaration_by_name