File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ impl ParseResult {
7474 }
7575}
7676
77- pub fn parse ( lines : & [ String ] ) -> ParseResult {
77+ pub fn parse < T : AsRef < str > > ( lines : & [ T ] ) -> ParseResult {
7878 let mut r = ParseResult :: new ( ) ;
7979 let mut part_first_line = 0 ;
8080 ' outer: loop {
@@ -83,7 +83,8 @@ pub fn parse(lines: &[String]) -> ParseResult {
8383 if part_first_line + 5 >= lines. len ( ) {
8484 break ' outer;
8585 }
86- if line_is_valid ( & lines[ part_first_line] ) && line_is_valid ( & lines[ part_first_line + 5 ] )
86+ if line_is_valid ( & lines[ part_first_line] . as_ref ( ) )
87+ && line_is_valid ( & lines[ part_first_line + 5 ] . as_ref ( ) )
8788 {
8889 break ;
8990 }
@@ -93,7 +94,7 @@ pub fn parse(lines: &[String]) -> ParseResult {
9394 r. offsets . push ( ( part_first_line as u32 , r. tick_stream . len ( ) as u32 ) ) ;
9495 let mut part: Vec < & str > = lines[ part_first_line..=part_first_line + 5 ]
9596 . iter ( )
96- . map ( |s| s. as_str ( ) . trim ( ) )
97+ . map ( |s| s. as_ref ( ) . trim ( ) )
9798 . collect ( ) ; // TODO: check if this is slow
9899
99100 // The current tick in THIS PART
You can’t perform that action at this time.
0 commit comments