MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / last_inner_ty

Function last_inner_ty

flow-derive/src/utils.rs:57–77  ·  view source on GitHub ↗
(ty: &syn::Type)

Source from the content-addressed store, hash-verified

55}
56
57pub fn last_inner_ty(ty: &syn::Type) -> Option<&syn::Type> {
58 if let syn::Type::Path(ref p) = ty {
59 if p.path.segments.is_empty() {
60 return None;
61 }
62
63 if let syn::PathArguments::AngleBracketed(ref inner_ty) =
64 p.path.segments.last().unwrap().arguments
65 {
66 if inner_ty.args.is_empty() {
67 return None;
68 }
69
70 let inner_ty = inner_ty.args.last().unwrap();
71 if let syn::GenericArgument::Type(ref t) = inner_ty {
72 return Some(t);
73 }
74 }
75 }
76 None
77}
78
79pub fn add_field(item: &mut ItemStruct, field: TokenStream) -> Result<()> {
80 match item.fields {

Callers 1

extract_portsFunction · 0.85

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected