8000 Increase inlining · unicode-rs/unicode-segmentation@86509ee · GitHub
[go: up one dir, main page]

Skip to content

Commit 86509ee

Browse files
committed
Increase inlining
1 parent a08c4e5 commit 86509ee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/grapheme.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ enum PairResult {
228228
Emoji, // a break if preceded by emoji base and (Extend)*
229229
}
230230

231+
#[inline]
231232
fn check_pair(before: GraphemeCat, after: GraphemeCat) -> PairResult {
232233
use crate::tables::grapheme::GraphemeCat::*;
233234
use self::PairResult::*;
@@ -407,6 +408,7 @@ impl GraphemeCursor {
407408
}
408409
}
409410

411+
#[inline]
410412
fn decide(&mut self, is_break: bool) {
411413
self.state = if is_break {
412414
GraphemeState::Break
@@ -415,11 +417,13 @@ impl GraphemeCursor {
415417
};
416418
}
417419

420+
#[inline]
418421
fn decision(&mut self, is_break: bool) -> Result<bool, GraphemeIncomplete> {
419422
self.decide(is_break);
420423
Ok(is_break)
421424
}
422425

426+
#[inline]
423427
fn is_boundary_result(&self) -> Result<bool, GraphemeIncomplete> {
424428
if self.state == GraphemeState::Break {
425429
Ok(true)
@@ -432,6 +436,7 @@ impl GraphemeCursor {
432436
}
433437
}
434438

439+
#[inline]
435440
fn handle_regional(&mut self, chunk: &str, chunk_start: usize) {
436441
use crate::tables::grapheme as gr;
437442
let mut ris_count = self.ris_count.unwrap_or(0);
@@ -452,6 +457,7 @@ impl GraphemeCursor {
452457
self.state = GraphemeState::Regional;
453458
}
454459

460+
#[inline]
455461
fn handle_emoji(&mut self, chunk: &str, chunk_start: usize) {
456462
use crate::tables::grapheme as gr;
457463
let mut iter = chunk.chars().rev();
@@ -482,6 +488,7 @@ impl GraphemeCursor {
482488
self.state = GraphemeState::Emoji;
483489
}
484490

491+
#[inline]
485492
/// Determine whether the current cursor location is a grapheme cluster boundary.
486493
/// Only a part of the string need be supplied. If `chunk_start` is nonzero or
487494
/// the length of `chunk` is not equal to `len` on creation, then this method
@@ -563,6 +570,7 @@ impl GraphemeCursor {
563570
}
564571
}
565572

573+
#[inline]
566574
/// Find the next boundary after the current cursor position. Only a part of
567575
/// the string need be supplied. If the chunk is incomplete, then this
568576
/// method might return `GraphemeIncomplete::PreContext` or

0 commit comments

Comments
 (0)
0