@@ -1813,13 +1813,15 @@ pub struct LookSet {
18131813
18141814impl LookSet {
18151815 /// Create an empty set of look-around assertions.
1816+ #[ inline]
18161817 pub fn empty ( ) -> LookSet {
18171818 LookSet { bits : 0 }
18181819 }
18191820
18201821 /// Create a full set of look-around assertions.
18211822 ///
18221823 /// This set contains all possible look-around assertions.
1824+ #[ inline]
18231825 pub fn full ( ) -> LookSet {
18241826 LookSet { bits : !0 }
18251827 }
@@ -1828,48 +1830,67 @@ impl LookSet {
18281830 ///
18291831 /// This is a convenience routine for creating an empty set and inserting
18301832 /// one look-around assertions.
1833+ #[ inline]
18311834 pub fn singleton ( look : Look ) -> LookSet {
18321835 let mut set = LookSet :: empty ( ) ;
18331836 set. insert ( look) ;
18341837 set
18351838 }
18361839
18371840 /// Returns the total number of look-around assertions in this set.
1841+ #[ inline]
18381842 pub fn len ( & self ) -> usize {
18391843 // OK because max value always fits in a u8, which in turn always
18401844 // fits in a usize, regardless of target.
18411845 usize:: try_from ( self . bits . count_ones ( ) ) . unwrap ( )
18421846 }
18431847
18441848 /// Returns true if and only if this set is empty.
1849+ #[ inline]
18451850 pub fn is_empty ( & self ) -> bool {
18461851 self . len ( ) == 0
18471852 }
18481853
18491854 /// Insert the given look-around assertions into this set. If the assertion
18501855 /// is already in the set, then this is a no-op.
1856+ #[ inline]
18511857 pub fn insert ( & mut self , look : Look ) {
18521858 self . bits |= 1 << look. as_repr ( ) ;
18531859 }
18541860
18551861 /// Remove the given look-around assertion from this set. If it wasn't
18561862 /// previously in the set, then this is a no-op.
1863+ #[ inline]
18571864 pub fn remove ( & mut self , look : Look ) {
18581865 self . bits &= !( 1 << look. as_repr ( ) ) ;
18591866 }
18601867
18611868 /// Returns true if and only if the given look-around assertion is in this
18621869 /// set.
1870+ #[ inline]
18631871 pub fn contains ( & self , look : Look ) -> bool {
18641872 self . bits & ( 1 << look. as_repr ( ) ) != 0
18651873 }
18661874
1875+ /// Returns true if and only if this set contains any word boundary or
1876+ /// negated word boundary assertions. This include both Unicode and ASCII
1877+ /// word boundaries.
1878+ #[ inline]
1879+ pub fn contains_word ( & self ) -> bool {
1880+ self . contains ( Look :: WordAscii )
1881+ || self . contains ( Look :: WordAsciiNegate )
1882+ || self . contains ( Look :: WordUnicode )
1883+ || self . contains ( Look :: WordUnicodeNegate )
1884+ }
1885+
18671886 /// Modifies this set to be the union of itself and the set given.
1887+ #[ inline]
18681888 pub fn union ( & mut self , other : LookSet ) {
18691889 self . bits |= other. bits ;
18701890 }
18711891
18721892 /// Modifies this set to be the intersection of itself and the set given.
1893+ #[ inline]
18731894 pub fn intersect ( & mut self , other : LookSet ) {
18741895 self . bits &= other. bits ;
18751896 }
0 commit comments