pub fn var_at_pos(pos: usize, text: &str) -> Option<Value> {
        assert!(pos <= text.len());
        for cap in BRACKET_ENV_VAR_REGEX.captures_iter(text) {
            let cap0 = cap.get(0).unwrap();
            let cap1 = cap.get(1);
            if pos >= cap0.start() && pos <= cap0.end() {
                if let Some(cap1_val) = cap1 {
                    return Some(cap1_val.as_str().to_string());
                }
            }
        }
        for cap in ENV_VAR_REGEX.captures_iter(text) {
            let cap = cap.get(0).unwrap();
            if pos >= cap.start() && pos <= cap.end() {
                return Some(cap.as_str().to_string());
            }
        }
        None
    }
/// Returns environment variable at position in text.
Returns environment variable at position in text.
Returns environment variable at position in text .
pub fn var_at_pos(pos: usize, text: &str) -> Option<Value> {
        assert!(pos <= text.len());
        for cap in BRACKET_ENV_VAR_REGEX.captures_iter(text) {
            let cap0 = cap.get(0).unwrap();
            let cap1 = cap.get(1);
            if pos >= cap0.start() && pos <= cap0.end() {
                if let Some(cap1_val) = cap1 {
                    return Some(cap1_val.as_str().to_string());
                }
            }
        }
        for cap in ENV_VAR_REGEX.captures_iter(text) {
            let cap = cap.get(0).unwrap();
            if pos >= cap.start() && pos <= cap.end() {
                return Some(cap.as_str().to_string());
            }
        }
        None
    }
pub fn var_at_pos ( pos : usize , text : & str ) -> Option < Value > { assert ! ( pos text len ( ) ) ; for cap in BRACKET_ENV_VAR_REGEX . captures_iter ( text ) { let cap0 = cap . get ( 0 ) . unwrap ( ) ; let cap1 = cap . get ( 1 ) ; if pos >= cap0 . start ( ) && pos <= cap0 . end ( ) { if let Some ( cap1_val ) = cap1 { return Some ( cap1_val . as_str ( ) . to_string ( ) ) ; } } } for cap in ENV_VAR_REGEX . captures_iter ( text ) { let cap = cap . get ( 0 ) . unwrap ( ) ; if pos >= cap . start ( ) && pos <= cap . end ( ) { return Some ( cap . as_str ( ) . to_string ( ) ) ; } } None }
Returns environment variable at position in text.
Returns environment variable at position in text .
pos
usize
text
&str