pub struct ShortName<'a>(pub &'a str);
Expand description
Lazily shortens a type name to remove all module paths.
The short name of a type is its full name as returned by
core::any::type_name
, but with the prefix of all paths removed. For
example, the short name of alloc::vec::Vec<core::option::Option<u32>>
would be Vec<Option<u32>>
.
Shortening is performed lazily without allocation.
To get a String
from this type, use the to_string
method.
§Examples
// Baz
let short_name = ShortName::of::<foo::bar::Baz>();
Tuple Fields§
§0: &'a str
Implementations§
Trait Implementations§
impl<'a> Copy for ShortName<'a>
Auto Trait Implementations§
impl<'a> Freeze for ShortName<'a>
impl<'a> RefUnwindSafe for ShortName<'a>
impl<'a> Send for ShortName<'a>
impl<'a> Sync for ShortName<'a>
impl<'a> Unpin for ShortName<'a>
impl<'a> UnwindSafe for ShortName<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)