We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ef5d7e6 commit f3d9db0Copy full SHA for f3d9db0
1 file changed
aoc_utils/src/lib.rs
@@ -412,6 +412,20 @@ impl<'a> InputParse<'a> for &'a str {
412
}
413
414
415
+pub trait MapUtils {
416
+ fn points(&self) -> Vec<Point>;
417
+}
418
+
419
+impl<T> MapUtils for Vec<Vec<T>> {
420
+ fn points(&self) -> Vec<Point> {
421
+ self.iter()
422
+ .enumerate()
423
+ .map(|(x, v)| v.iter().enumerate().map(|(y, _)| Point(x, y)).collect_vec())
424
+ .flatten()
425
+ .collect_vec()
426
+ }
427
428
429
/// Extract numbers from regex captures
430
pub trait ExtractNum {
431
/// Parse capture group at position to number type
0 commit comments