Skip to content

Commit 1f678b0

Browse files
committed
Improve inner naming
1 parent b8182e8 commit 1f678b0

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/chunk.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use crate::{CowStr, span::Span, ChunkIdx};
1+
use crate::{span::Span, ChunkIdx, CowStr};
22

33
#[derive(Debug, Default)]
44
pub struct Chunk<'s> {
55
intro: Vec<CowStr<'s>>,
66
span: Span,
77
outro: Vec<CowStr<'s>>,
88
len: usize,
9-
pub(crate) next: Option<ChunkIdx>
9+
pub(crate) next: Option<ChunkIdx>,
1010
}
1111

1212
impl<'s> Chunk<'s> {
@@ -41,3 +41,4 @@ impl<'s> Chunk<'s> {
4141
self.len
4242
}
4343
}
44+

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mod span;
44
mod joiner;
55
mod magic_string;
66
use std::borrow::Cow;
7+
mod intersperse_shim;
78

89
type CowStr<'s> = Cow<'s, str>;
910

src/magic_string.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ pub struct MagicStringOptions {
99

1010
#[derive(Default)]
1111
pub struct MagicString<'s> {
12+
pub filename: Option<String>,
13+
1214
source: CowStr<'s>,
1315
source_len: u32,
1416
chunks: ChunkVec<'s>,
15-
first_chunk: Option<ChunkIdx>,
17+
first_chunk_idx: Option<ChunkIdx>,
1618
chunk_by_start: FxHashMap<u32, ChunkIdx>,
1719
chunk_by_end: FxHashMap<u32, ChunkIdx>,
18-
pub filename: Option<String>,
1920
}
2021

2122
impl<'s> MagicString<'s> {
@@ -34,7 +35,7 @@ impl<'s> MagicString<'s> {
3435
..Default::default()
3536
};
3637
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));
3839

3940
magic_string.filename = options.filename;
4041

@@ -66,7 +67,7 @@ impl<'s> MagicString<'s> {
6667

6768
fn iter_chunks(&self) -> impl Iterator<Item = &Chunk> {
6869
ChunkIter {
69-
next: self.first_chunk,
70+
next: self.first_chunk_idx,
7071
chunks: &self.chunks,
7172
}
7273
}

0 commit comments

Comments
 (0)