mirl 9.2.0

Miners Rust Lib - A massive collection of ever growing and changing functions, structs, and enums. Check the description for compatibility and toggleable features! (Most of the lib is controlled by flags/features so the lib can continue to be lightweight despite its size)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::misc::EasyUnwrapUnchecked;

/// A trait from getting a char from
pub const trait CharGetPos {
    /// When you 100% know the position exists
    ///
    /// The person using this function is responsible for its safety
    fn get_at(&mut self, position: usize) -> char;
}
impl CharGetPos for core::str::Chars<'_> {
    fn get_at(&mut self, position: usize) -> char {
        let _ = self.advance_by(position);
        self.next().easy_unwrap_unchecked()
    }
}