MCPcopy Create free account
hub / github.com/biblius/validify / is_list

Function is_list

validify_derive/src/fields.rs:404–428  ·  view source on GitHub ↗
(ty: &syn::Type)

Source from the content-addressed store, hash-verified

402}
403
404fn is_list(ty: &syn::Type) -> bool {
405 if let Some(ty) = try_extract_option(ty) {
406 return is_list(ty);
407 }
408
409 // We consider arrays lists
410 if let syn::Type::Array(_) = ty {
411 return true;
412 }
413
414 // If it's not a path, it's not a list
415 let syn::Type::Path(p) = ty else {
416 return false;
417 };
418
419 // Always check the last arg such as in `std::vec::Vec`
420 let Some(seg) = p.path.segments.last() else {
421 return false;
422 };
423
424 seg.ident == "Vec"
425 || seg.ident == "HashSet"
426 || seg.ident == "BTreeSet"
427 || seg.ident == "IndexSet"
428}
429
430fn is_map(ty: &syn::Type) -> bool {
431 if let Some(ty) = try_extract_option(ty) {

Callers 1

is_listMethod · 0.85

Calls 1

try_extract_optionFunction · 0.85

Tested by

no test coverage detected