Add some useful comments.
This commit is contained in:
parent
c6bbb376a2
commit
08b8ba0a32
1 changed files with 8 additions and 4 deletions
|
@ -7,7 +7,9 @@ use std::str::Chars;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
/// Errors and warnings that can occur during string unescaping.
|
/// Errors and warnings that can occur during string unescaping. They mostly
|
||||||
|
/// relate to malformed escape sequences, but there are a few that are about
|
||||||
|
/// other problems.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum EscapeError {
|
pub enum EscapeError {
|
||||||
/// Expected 1 char, but 0 were found.
|
/// Expected 1 char, but 0 were found.
|
||||||
|
@ -73,9 +75,11 @@ impl EscapeError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Takes a contents of a literal (without quotes) and produces a
|
/// Takes a contents of a literal (without quotes) and produces a sequence of
|
||||||
/// sequence of escaped characters or errors.
|
/// escaped characters or errors.
|
||||||
/// Values are returned through invoking of the provided callback.
|
///
|
||||||
|
/// Values are returned by invoking `callback`. For `Char` and `Byte` modes,
|
||||||
|
/// the callback will be called exactly once.
|
||||||
pub fn unescape_literal<F>(src: &str, mode: Mode, callback: &mut F)
|
pub fn unescape_literal<F>(src: &str, mode: Mode, callback: &mut F)
|
||||||
where
|
where
|
||||||
F: FnMut(Range<usize>, Result<char, EscapeError>),
|
F: FnMut(Range<usize>, Result<char, EscapeError>),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue