logo
pub fn type_parameters<R>(ty: &Type, range: R) -> Vec<&Type>Notable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
    A: Allocator
where
    R: Into<Interval>, 
Expand description

Return the specified number of parameters of the type.

Good to getting i32 from core::option::Option< i32 > or alloc::vec::Vec< i32 >

Sample

use proc_macro_tools::*;

let code = qt!( core::option::Option< i8, i16, i32, i64 > );
let tree_type = syn::parse2::< syn::Type >( code ).unwrap();
let got = type_parameters( &tree_type, 0..=2 );
got.iter().for_each( | e | println!( "{}", qt!( #e ) ) );
// < i8
// < i16
// < i32