MCPcopy Create free account
hub / github.com/AxlLind/AdventOfCode / parse_num

Function parse_num

2021/src/bin/18.rs:14–25  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

12}
13
14fn parse_num(s: &str) -> Vec<(u32,u8)> {
15 let (mut d, mut num) = (0, Vec::new());
16 for c in s.chars() {
17 match c {
18 '[' => d += 1,
19 ']' => d -= 1,
20 ',' => {}
21 _ => num.push(((c as u8 - b'0') as u32, d)),
22 }
23 }
24 num
25}
26
27fn explode(num: &mut Vec<(u32,u8)>) {
28 loop {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected