Convert rust_crate_map.cpp to Rust

This patch converts the rust_crate_map.cpp to Rust as mentioned at the end of #8880.