Skip to content

Commit 167b510

Browse files
committed
Implement last for EscapeUnicode
Part of #24214.
1 parent 3dd88f6 commit 167b510

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libcore/char.rs

+12
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,18 @@ impl Iterator for EscapeUnicode {
471471
let n = n + self.hex_digit_idx;
472472
(n, Some(n))
473473
}
474+
475+
fn last(self) -> Option<char> {
476+
match self.state {
477+
EscapeUnicodeState::Done => None,
478+
479+
EscapeUnicodeState::RightBrace |
480+
EscapeUnicodeState::Value |
481+
EscapeUnicodeState::LeftBrace |
482+
EscapeUnicodeState::Type |
483+
EscapeUnicodeState::Backslash => Some('}'),
484+
}
485+
}
474486
}
475487

476488
/// An iterator that yields the literal escape code of a `char`.

0 commit comments

Comments
 (0)