File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -313,7 +313,7 @@ impl Delimiters {
313
313
}
314
314
315
315
#[ inline]
316
- fn from_byte ( byte : Option < u8 > ) -> Delimiters {
316
+ pub ( crate ) fn from_byte ( byte : Option < u8 > ) -> Delimiters {
317
317
const TABLE : [ Delimiters ; 255 ] = {
318
318
let mut table = [ Delimiter :: None ; 255 ] ;
319
319
table[ b';' as usize ] = Delimiter :: Semicolon ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use encoding_rs;
9
9
use serde_json:: { self , json, Map , Value } ;
10
10
11
11
use crate :: color:: { parse_color_with, FromParsedColor } ;
12
- use crate :: { ColorParser , PredefinedColorSpace } ;
12
+ use crate :: { ColorParser , PredefinedColorSpace , Delimiters } ;
13
13
14
14
#[ cfg( feature = "bench" ) ]
15
15
use self :: test:: Bencher ;
@@ -922,6 +922,18 @@ impl<'a> ToJson for CowRcStr<'a> {
922
922
}
923
923
}
924
924
925
+ #[ bench]
926
+ #[ cfg( feature = "bench" ) ]
927
+ fn delimiter_from_byte ( b : & mut Bencher ) {
928
+ b. iter ( || {
929
+ for _ in 0 ..1000 {
930
+ for i in 0 ..255 {
931
+ std:: hint:: black_box ( Delimiters :: from_byte ( Some ( i as u8 ) ) ) ;
932
+ }
933
+ }
934
+ } )
935
+ }
936
+
925
937
#[ cfg( feature = "bench" ) ]
926
938
const BACKGROUND_IMAGE : & ' static str = include_str ! ( "big-data-url.css" ) ;
927
939
You can’t perform that action at this time.
0 commit comments