• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use regex_automata::DFA;
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.
whitespace_len_fwd(slice: &[u8]) -> usize9 pub fn whitespace_len_fwd(slice: &[u8]) -> usize {
10     WHITESPACE_ANCHORED_FWD.find(slice).unwrap_or(0)
11 }
12 
13 /// Return the last position of a non-whitespace character.
whitespace_len_rev(slice: &[u8]) -> usize14 pub fn whitespace_len_rev(slice: &[u8]) -> usize {
15     WHITESPACE_ANCHORED_REV.rfind(slice).unwrap_or(slice.len())
16 }
17