Skip to content

Commit

Permalink
Implement last for EscapeUnicode
Browse files Browse the repository at this point in the history
Part of #24214.
  • Loading branch information
ranma42 committed Apr 20, 2016
1 parent 3dd88f6 commit 167b510
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libcore/char.rs
Expand Up @@ -471,6 +471,18 @@ impl Iterator for EscapeUnicode {
let n = n + self.hex_digit_idx;
(n, Some(n))
}

fn last(self) -> Option<char> {
match self.state {
EscapeUnicodeState::Done => None,

EscapeUnicodeState::RightBrace |
EscapeUnicodeState::Value |
EscapeUnicodeState::LeftBrace |
EscapeUnicodeState::Type |
EscapeUnicodeState::Backslash => Some('}'),
}
}
}

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

0 comments on commit 167b510

Please sign in to comment.