Just a runnable solution
Code\n\nimpl Solution {\n    pub fn smallest_missing_value_subtree(parents: Vec<i32>, nums: Vec<i32>) -> Vec<i32> {\n        fn dfs(i: usize, children: &Vec<Vec
# Code\n```\nimpl Solution {\n    pub fn smallest_missing_value_subtree(parents: Vec<i32>, nums: Vec<i32>) -> Vec<i32> {\n        fn dfs(i: usize, children: &Vec<Vec<usize>>, seen: &mut Vec<bool>, nums: &Vec<i32>) {\n            if seen[nums[i] as usize] {\n                return;\n            }\n            for &j in &children[i] {\n                dfs(j, children, seen, nums);\n            }\n            seen[nums[i] as usize] = true;\n        }\n    \n        let n = parents.len();\n        let mut res = vec![1; n];\n        let mut seen = vec![false; 100010];\n        let it = nums.iter().position(|&x| x == 1);\n        if it.is_none() {\n            return res;\n        }\n        let mut children = vec![vec![]; n];\n        for i in 1..n {\n            children[parents[i] as usize].push(i);\n        }\n        let mut i = it.unwrap() as i32;\n        let mut miss = 1;\n        while i > -1 {\n            dfs(i as usize, &children, &mut seen, &nums);\n            while seen[miss as usize] {\n                miss += 1;\n            }\n            res[i as usize] = miss;\n            i = parents[i as usize];\n        }\n        res\n    }\n}\n```
['Rust']