# 1.38.0[−][src]Function core::any::type_name

    pub fn type_name<T: ?Sized>() -> &'static str

Returns the name of a type as a string slice.

# Note

This is intended for diagnostic use. The exact contents and format of the string are not specified, other than being a best-effort description of the type. For example, `type_name::<Option<String>>()` could return the `"Option<String>"` or `"std::option::Option<std::string::String>"`, but not `"foobar"`. In addition, the output may change between versions of the compiler.

The type name should not be considered a unique identifier of a type; multiple types may share the same type name.

The current implementation uses the same infrastructure as compiler diagnostics and debuginfo, but this is not guaranteed.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)