Just a runnable solution
Code\n\nimpl Solution {\n    pub fn first_day_been_in_all_rooms(next_visit: Vec<i32>) -> i32 {\n        let mod_num = 1_000_000_007;\n        let mut dp = vec![
# Code\n```\nimpl Solution {\n    pub fn first_day_been_in_all_rooms(next_visit: Vec<i32>) -> i32 {\n        let mod_num = 1_000_000_007;\n        let mut dp = vec![0_i64; next_visit.len() + 1];\n        for i in 1..next_visit.len() {\n            dp[i] = (2 + 2 * dp[i - 1] - dp[next_visit[i - 1] as usize] + mod_num) % mod_num;\n        }\n        dp[next_visit.len() - 1] as _\n    }\n}\n```
['Rust']