onig_string.rs 800 字节
Newer Older
P
Phodal Huang 已提交
1
pub struct OnigString {
P
Phodal Huang 已提交
2 3 4 5 6 7
 pub utf16length: i32,
 pub utf8length: i32,
 pub utf16value: String,
 pub utf8value: Vec<u8>,
 pub utf16offset_to_utf8: Option<Vec<u32>>,
 pub utf8offset_to_utf16: Option<Vec<u32>>,
P
Phodal Huang 已提交
8 9 10 11

}

impl OnigString {
P
Phodal Huang 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
    pub fn new(str: String) -> Self {
        let utf16Length = str.len();
        

        OnigString {
            utf16length: 0,
            utf8length: 0,
            utf16value: "".to_string(),
            utf8value: vec![],
            utf16offset_to_utf8: None,
            utf8offset_to_utf16: None
        }
    }
}


#[cfg(test)]
mod tests {
    use crate::scanner::onig_scanner::OnigScanner;
    use crate::scanner::onig_string::OnigString;

    #[test]
    fn it_show_works_works() {
        OnigString::new(String::from(""));
        assert!(true)
P
Phodal Huang 已提交
37 38
    }
}