Helper function for formatting a byte as a nice-to-read escaped string.
(b: usize)
| 1830 | |
| 1831 | /// Helper function for formatting a byte as a nice-to-read escaped string. |
| 1832 | fn vb(b: usize) -> String { |
| 1833 | use std::ascii::escape_default; |
| 1834 | |
| 1835 | if b > ::std::u8::MAX as usize { |
| 1836 | "EOF".to_owned() |
| 1837 | } else { |
| 1838 | let escaped = escape_default(b as u8).collect::<Vec<u8>>(); |
| 1839 | String::from_utf8_lossy(&escaped).into_owned() |
| 1840 | } |
| 1841 | } |
| 1842 | |
| 1843 | fn usize_to_u32(n: usize) -> u32 { |
| 1844 | if (n as u64) > (::std::u32::MAX as u64) { |