/rust/registry/src/index.crates.io-1949cf8c6b5b557f/bstr-1.12.1/src/unicode/whitespace.rs
Line | Count | Source |
1 | | use regex_automata::{dfa::Automaton, Anchored, Input}; |
2 | | |
3 | | use crate::unicode::fsm::{ |
4 | | whitespace_anchored_fwd::WHITESPACE_ANCHORED_FWD, |
5 | | whitespace_anchored_rev::WHITESPACE_ANCHORED_REV, |
6 | | }; |
7 | | |
8 | | /// Return the first position of a non-whitespace character. |
9 | 0 | pub fn whitespace_len_fwd(slice: &[u8]) -> usize { |
10 | 0 | let input = Input::new(slice).anchored(Anchored::Yes); |
11 | 0 | WHITESPACE_ANCHORED_FWD |
12 | 0 | .try_search_fwd(&input) |
13 | 0 | .unwrap() |
14 | 0 | .map_or(0, |hm| hm.offset()) Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_fwd::{closure#0}Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_fwd::{closure#0}Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_fwd::{closure#0} |
15 | 0 | } Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_fwd Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_fwd Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_fwd |
16 | | |
17 | | /// Return the last position of a non-whitespace character. |
18 | 0 | pub fn whitespace_len_rev(slice: &[u8]) -> usize { |
19 | 0 | let input = Input::new(slice).anchored(Anchored::Yes); |
20 | 0 | WHITESPACE_ANCHORED_REV |
21 | 0 | .try_search_rev(&input) |
22 | 0 | .unwrap() |
23 | 0 | .map_or(slice.len(), |hm| hm.offset()) Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_rev::{closure#0}Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_rev::{closure#0}Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_rev::{closure#0} |
24 | 0 | } Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_rev Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_rev Unexecuted instantiation: bstr::unicode::whitespace::whitespace_len_rev |