generic-programming

Are there any ways to recursively flatten tuples?

瘦欲@ 提交于 2021-01-20 05:57:05
问题 In Rust, is there any way to use trait s and impl s to (recursively) flatten tuples? If it helps, something that works with N nested pairs is a good start trait FlattenTuple { fn into_flattened(self) -> /* ??? */ } // such that assert_eq!((1, (2, 3)).into_flattened(), (1, 2, 3)) It would be even better if it could be extended work with any kind of nested tuple such that: assert_eq!(((1, 2), 2, (3, (4, 5))).into_flattened(), (1, 2, 2, 3, 4, 5)) 回答1: Maybe for certain small definitions of

Getting files in controller without @RequestParam name

本秂侑毒 提交于 2021-01-07 07:35:26
问题 I'm trying to build a generic POST controller. I can access params in a generic way but I can't get possible files without using @RequestParam("files") MultipartFile[] files so, does anyone know how to get files (if there are any submitted) in a generic way? This is my controller so far: @PostMapping public void save(@RequestParam MultiValueMap<String, Object> o) { Iterator it = o.keySet().iterator(); while(it.hasNext()){ String key = (String) it.next(); String value = (String) o.getFirst(key