File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
- use crate :: { CowStr , span:: Span , ChunkIdx } ;
1
+ use crate :: { span:: Span , ChunkIdx , CowStr } ;
2
2
3
3
#[ derive( Debug , Default ) ]
4
4
pub struct Chunk < ' s > {
5
5
intro : Vec < CowStr < ' s > > ,
6
6
span : Span ,
7
7
outro : Vec < CowStr < ' s > > ,
8
8
len : usize ,
9
- pub ( crate ) next : Option < ChunkIdx >
9
+ pub ( crate ) next : Option < ChunkIdx > ,
10
10
}
11
11
12
12
impl < ' s > Chunk < ' s > {
@@ -41,3 +41,4 @@ impl<'s> Chunk<'s> {
41
41
self . len
42
42
}
43
43
}
44
+
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ mod span;
4
4
mod joiner;
5
5
mod magic_string;
6
6
use std:: borrow:: Cow ;
7
+ mod intersperse_shim;
7
8
8
9
type CowStr < ' s > = Cow < ' s , str > ;
9
10
Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ pub struct MagicStringOptions {
9
9
10
10
#[ derive( Default ) ]
11
11
pub struct MagicString < ' s > {
12
+ pub filename : Option < String > ,
13
+
12
14
source : CowStr < ' s > ,
13
15
source_len : u32 ,
14
16
chunks : ChunkVec < ' s > ,
15
- first_chunk : Option < ChunkIdx > ,
17
+ first_chunk_idx : Option < ChunkIdx > ,
16
18
chunk_by_start : FxHashMap < u32 , ChunkIdx > ,
17
19
chunk_by_end : FxHashMap < u32 , ChunkIdx > ,
18
- pub filename : Option < String > ,
19
20
}
20
21
21
22
impl < ' s > MagicString < ' s > {
@@ -34,7 +35,7 @@ impl<'s> MagicString<'s> {
34
35
..Default :: default ( )
35
36
} ;
36
37
magic_string. split_at ( source_len) ;
37
- magic_string. first_chunk = Some ( ChunkIdx :: from_raw ( 0 ) ) ;
38
+ magic_string. first_chunk_idx = Some ( ChunkIdx :: from_raw ( 0 ) ) ;
38
39
39
40
magic_string. filename = options. filename ;
40
41
@@ -66,7 +67,7 @@ impl<'s> MagicString<'s> {
66
67
67
68
fn iter_chunks ( & self ) -> impl Iterator < Item = & Chunk > {
68
69
ChunkIter {
69
- next : self . first_chunk ,
70
+ next : self . first_chunk_idx ,
70
71
chunks : & self . chunks ,
71
72
}
72
73
}
You can’t perform that action at this time.
0 commit comments