Function macro_tools::typ::type_rightmost
source · pub fn type_rightmost(ty: &Type) -> Option<String>
Expand description
Check is the rightmost item of path refering a type is specified type.
Good to verify core::option::Option< i32 >
is optional.
Good to verify alloc::vec::Vec< i32 >
is vector.
§Basic use-case.
use macro_tools::exposed::*;
let code = qt!( core::option::Option< i32 > );
let tree_type = syn::parse2::< syn::Type >( code ).unwrap();
let got = typ::type_rightmost( &tree_type );
assert_eq!( got, Some( "Option".to_string() ) );