Skip to content

Commit f03f3e1

Browse files
committed
inline OriginalSource rope
1 parent 6e46ac9 commit f03f3e1

File tree

6 files changed

+11
-0
lines changed

6 files changed

+11
-0
lines changed

src/cached_source.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ impl Source for CachedSource {
107107
SourceValue::String(Cow::Owned(string))
108108
}
109109

110+
#[inline]
110111
fn rope<'a>(&'a self, on_chunk: &mut dyn FnMut(&'a str)) {
111112
let chunks = self.get_or_init_chunks();
112113
chunks.iter().for_each(|chunk| on_chunk(chunk));

src/concat_source.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ impl Source for ConcatSource {
177177
SourceValue::String(Cow::Owned(string))
178178
}
179179

180+
#[inline]
180181
fn rope<'a>(&'a self, on_chunk: &mut dyn FnMut(&'a str)) {
181182
let children = self.optimized_children();
182183
children.iter().for_each(|child| {

src/original_source.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ impl Source for OriginalSource {
5656
SourceValue::String(Cow::Borrowed(&self.value))
5757
}
5858

59+
#[inline]
5960
fn rope<'a>(&'a self, on_chunk: &mut dyn FnMut(&'a str)) {
6061
on_chunk(self.value.as_ref())
6162
}

src/raw_source.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl Source for RawStringSource {
6464
SourceValue::String(Cow::Borrowed(&self.0))
6565
}
6666

67+
#[inline]
6768
fn rope<'a>(&'a self, on_chunk: &mut dyn FnMut(&'a str)) {
6869
on_chunk(self.0.as_ref())
6970
}

src/source.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,27 @@ pub trait Source:
140140
}
141141

142142
impl Source for BoxSource {
143+
#[inline]
143144
fn source(&self) -> SourceValue {
144145
self.as_ref().source()
145146
}
146147

148+
#[inline]
147149
fn rope<'a>(&'a self, on_chunk: &mut dyn FnMut(&'a str)) {
148150
self.as_ref().rope(on_chunk)
149151
}
150152

153+
#[inline]
151154
fn buffer(&self) -> Cow<[u8]> {
152155
self.as_ref().buffer()
153156
}
154157

158+
#[inline]
155159
fn size(&self) -> usize {
156160
self.as_ref().size()
157161
}
158162

163+
#[inline]
159164
fn map(
160165
&self,
161166
object_pool: &ObjectPool,
@@ -164,6 +169,7 @@ impl Source for BoxSource {
164169
self.as_ref().map(object_pool, options)
165170
}
166171

172+
#[inline]
167173
fn to_writer(&self, writer: &mut dyn std::io::Write) -> std::io::Result<()> {
168174
self.as_ref().to_writer(writer)
169175
}

src/source_map_source.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ impl Source for SourceMapSource {
9494
SourceValue::String(Cow::Borrowed(&self.value))
9595
}
9696

97+
#[inline]
9798
fn rope<'a>(&'a self, on_chunk: &mut dyn FnMut(&'a str)) {
9899
on_chunk(&self.value)
99100
}

0 commit comments

Comments
 (0)