File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -313,7 +313,7 @@ impl Delimiters {
313313 }
314314
315315 #[ inline]
316- fn from_byte ( byte : Option < u8 > ) -> Delimiters {
316+ pub ( crate ) fn from_byte ( byte : Option < u8 > ) -> Delimiters {
317317 const TABLE : [ Delimiters ; 255 ] = {
318318 let mut table = [ Delimiter :: None ; 255 ] ;
319319 table[ b';' as usize ] = Delimiter :: Semicolon ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use encoding_rs;
99use serde_json:: { self , json, Map , Value } ;
1010
1111use crate :: color:: { parse_color_with, FromParsedColor } ;
12- use crate :: { ColorParser , PredefinedColorSpace } ;
12+ use crate :: { ColorParser , PredefinedColorSpace , Delimiters } ;
1313
1414#[ cfg( feature = "bench" ) ]
1515use self :: test:: Bencher ;
@@ -922,6 +922,18 @@ impl<'a> ToJson for CowRcStr<'a> {
922922 }
923923}
924924
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+
925937#[ cfg( feature = "bench" ) ]
926938const BACKGROUND_IMAGE : & ' static str = include_str ! ( "big-data-url.css" ) ;
927939
You can’t perform that action at this time.
0 commit comments