Skip to content

Commit ad7f68d

Browse files
committed
Implement last for EscapeUnicode
Part of #24214.
1 parent 009e243 commit ad7f68d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/libcore/char.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,18 @@ impl Iterator for EscapeUnicode {
496496
fn count(self) -> usize {
497497
self.len()
498498
}
499+
500+
fn last(self) -> Option<char> {
501+
match self.state {
502+
EscapeUnicodeState::Done => None,
503+
504+
EscapeUnicodeState::RightBrace |
505+
EscapeUnicodeState::Value |
506+
EscapeUnicodeState::LeftBrace |
507+
EscapeUnicodeState::Type |
508+
EscapeUnicodeState::Backslash => Some('}'),
509+
}
510+
}
499511
}
500512

501513
#[stable(feature = "rust1", since = "1.7.0")]

0 commit comments

Comments
 (0)