xref: /DragonOS/kernel/src/libs/name.rs (revision cf7f801e1d50ee5b04cb728e4251a57f4183bfbc)
1 use core::any::type_name;
2 
3 use alloc::string::{String, ToString};
4 
5 #[allow(dead_code)]
get_full_type_name<T>(_: &T) -> String6 pub fn get_full_type_name<T>(_: &T) -> String {
7     type_name::<T>().to_string()
8 }
9 
get_type_name<T>(_: &T) -> String10 pub fn get_type_name<T>(_: &T) -> String {
11     let full_name = type_name::<T>();
12     full_name[(full_name.rfind("::").unwrap_or(0) + 2)..].to_string()
13 }
14