Returns a list of all generic types used in the node
(types: &NodeIOTypes)
| 844 | |
| 845 | /// Returns a list of all generic types used in the node |
| 846 | fn collect_generics(types: &NodeIOTypes) -> Vec<Cow<'static, str>> { |
| 847 | let inputs = [&types.call_argument].into_iter().chain(types.inputs.iter().map(|x| x.nested_type())); |
| 848 | let mut generics = inputs |
| 849 | .filter_map(|t| match t { |
| 850 | Type::Generic(out) => Some(out.clone()), |
| 851 | _ => None, |
| 852 | }) |
| 853 | .collect::<Vec<_>>(); |
| 854 | if let Type::Generic(out) = &types.return_value { |
| 855 | generics.push(out.clone()); |
| 856 | } |
| 857 | generics.dedup(); |
| 858 | generics |
| 859 | } |
| 860 | |
| 861 | /// Checks if a generic type can be substituted with a concrete type and returns the concrete type |
| 862 | fn check_generic(types: &NodeIOTypes, input: &Type, parameters: &[Type], generic: &str) -> Result<Type, String> { |