Replace deprecated indexing method for Rust.