| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#}; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/, FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#}; |
| 4 | |
| 5 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 6 | pub enum CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError# { |
| 7 | UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#UnexpectedEof#, |
| 8 | Utf8rust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Utf8#(strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#), |
| 9 | Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#), |
| 10 | } |
| 11 | |
| 12 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#> for CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError# { |
| 13 | #[cold] |
| 14 | fn fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReadError][`From<str::Utf8Error>`]from().(e: strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#) -> CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError# { |
| 15 | CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::Utf8rust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Utf8#(e) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> for CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError# { |
| 20 | #[cold] |
| 21 | fn fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReadError][`From<io::Error>`]from().(e: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError# { |
| 22 | CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#(e) |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError# { |
| 27 | #[cold] |
| 28 | fn fmtrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReadError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 29 | use selfrust-analyzer cargo xml-rs 0.8.19 util/::CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::{Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#, UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#UnexpectedEof#, Utf8rust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Utf8#}; |
| 30 | match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self { |
| 31 | UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#UnexpectedEof# => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "unexpected end of stream"), |
| 32 | Utf8rust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Utf8#(ref e) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "UTF-8 decoding error: {e}"), |
| 33 | Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#(ref e) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "I/O error: {e}"), |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /// Character encoding used for parsing |
| 39 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 40 | #[non_exhaustive] |
| 41 | pub enum Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding# { |
| 42 | /// Explicitly UTF-8 only |
| 43 | Utf8rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf8#, |
| 44 | /// UTF-8 fallback, but can be any 8-bit encoding |
| 45 | Defaultrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Default#, |
| 46 | /// ISO-8859-1 |
| 47 | Latin1rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Latin1#, |
| 48 | /// US-ASCII |
| 49 | Asciirust-analyzer cargo xml-rs 0.8.19 util/Encoding#Ascii#, |
| 50 | /// Big-Endian |
| 51 | Utf16Berust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Be#, |
| 52 | /// Little-Endian |
| 53 | Utf16Lerust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Le#, |
| 54 | /// Unknown endianness yet, will be sniffed |
| 55 | Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16#, |
| 56 | /// Not determined yet, may be sniffed to be anything |
| 57 | Unknownrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Unknown#, |
| 58 | } |
| 59 | |
| 60 | // Rustc inlines eq_ignore_ascii_case and creates kilobytes of code! |
| 61 | #[inline(never)] |
| 62 | fn icmprust-analyzer cargo xml-rs 0.8.19 util/icmp().(lower: &str, varcase: &str) -> bool { |
| 63 | lower.bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]bytes().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(varcase.bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]bytes().()).allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|(l, v)| l rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().v.to_ascii_lowercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]to_ascii_lowercase().()) |
| 64 | } |
| 65 | |
| 66 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding# { |
| 67 | type Errrust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][FromStr]Err# = &'static str; |
| 68 | |
| 69 | fn from_strrust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][FromStr]from_str().(val: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][FromStr], Selfrust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 70 | if ["utf-8", "utf8"].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(move |label| icmprust-analyzer cargo xml-rs 0.8.19 util/icmp().(label, val)) { |
| 71 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf8rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf8#) |
| 72 | } else if ["iso-8859-1", "latin1"].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(move |label| icmprust-analyzer cargo xml-rs 0.8.19 util/icmp().(label, val)) { |
| 73 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Latin1rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Latin1#) |
| 74 | } else if ["utf-16", "utf16"].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(move |label| icmprust-analyzer cargo xml-rs 0.8.19 util/icmp().(label, val)) { |
| 75 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16#) |
| 76 | } else if ["ascii", "us-ascii"].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(move |label| icmprust-analyzer cargo xml-rs 0.8.19 util/icmp().(label, val)) { |
| 77 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Asciirust-analyzer cargo xml-rs 0.8.19 util/Encoding#Ascii#) |
| 78 | } else { |
| 79 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#("unknown encoding name") |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding# { |
| 85 | #[cold] |
| 86 | fn fmtrust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 87 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(match self { |
| 88 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf8rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf8# => "UTF-8", |
| 89 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Defaultrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Default# => "UTF-8", |
| 90 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Latin1rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Latin1# => "ISO-8859-1", |
| 91 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Asciirust-analyzer cargo xml-rs 0.8.19 util/Encoding#Ascii# => "US-ASCII", |
| 92 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Berust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Be# => "UTF-16", |
| 93 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Lerust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Le# => "UTF-16", |
| 94 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16# => "UTF-16", |
| 95 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Unknownrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Unknown# => "(unknown)", |
| 96 | }) |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | pub(craterust-analyzer cargo xml-rs 0.8.19 crate/) struct CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { |
| 101 | pub encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#, |
| 102 | } |
| 103 | |
| 104 | impl CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { |
| 105 | pub fn newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().() -> Selfrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader] { |
| 106 | Selfrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader] { |
| 107 | encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Unknownrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Unknown#, |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | pub fn next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(&mut self, source: &mut R) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<char>, CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#> { |
| 112 | let mut bytes = source.bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#bytes().(); |
| 113 | const MAX_CODEPOINT_LENrust-analyzer cargo xml-rs 0.8.19 util/MAX_CODEPOINT_LEN.: usize = 4; |
| 114 | |
| 115 | let mut buf = [0u8; MAX_CODEPOINT_LENrust-analyzer cargo xml-rs 0.8.19 util/MAX_CODEPOINT_LEN.]; |
| 116 | let mut pos = 0; |
| 117 | loop { |
| 118 | let next = match bytes.nextrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/impl#[`Bytes<R>`][Iterator]next().() { |
| 119 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(b)) => b, |
| 120 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e)) => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 121 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 122 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#UnexpectedEof#), |
| 123 | }; |
| 124 | |
| 125 | match self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. { |
| 126 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf8rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf8# | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Defaultrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Default# => { |
| 127 | // fast path for ASCII subset |
| 128 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 && next.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii().() { |
| 129 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 130 | } |
| 131 | |
| 132 | buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = next; |
| 133 | pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 134 | |
| 135 | match strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(&buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().) { |
| 136 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(s) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(s.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().()), // always Some(..) |
| 137 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().MAX_CODEPOINT_LENrust-analyzer cargo xml-rs 0.8.19 util/MAX_CODEPOINT_LEN. => continue, |
| 138 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()), |
| 139 | } |
| 140 | }, |
| 141 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Latin1rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Latin1# => { |
| 142 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 143 | }, |
| 144 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Asciirust-analyzer cargo xml-rs 0.8.19 util/Encoding#Ascii# => { |
| 145 | if next.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii().() { |
| 146 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 147 | } else { |
| 148 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#, "char is not ASCII"))); |
| 149 | } |
| 150 | }, |
| 151 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Unknownrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Unknown# | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16# => { |
| 152 | buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = next; |
| 153 | pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 154 | |
| 155 | // sniff BOM |
| 156 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().3 && buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq().[0xEF, 0xBB, 0xBF][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). { |
| 157 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().3 && self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16# { |
| 158 | pos = 0; |
| 159 | self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. = Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf8rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf8#; |
| 160 | } |
| 161 | } else if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().2 && buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq().[0xFE, 0xFF][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). { |
| 162 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2 { |
| 163 | pos = 0; |
| 164 | self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. = Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Berust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Be#; |
| 165 | } |
| 166 | } else if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().2 && buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][`PartialEq<[U]>`]eq().[0xFF, 0xFE][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). { |
| 167 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2 { |
| 168 | pos = 0; |
| 169 | self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. = Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Lerust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Le#; |
| 170 | } |
| 171 | } else if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 && self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. rust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 util/impl#[Encoding][`PartialEq<Self>`]eq().Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16# { |
| 172 | // sniff ASCII char in UTF-16 |
| 173 | self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. = if next rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().0 { Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Berust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Be# } else { Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Lerust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Le# }; |
| 174 | } else { |
| 175 | // UTF-8 is the default, but XML decl can change it to other 8-bit encoding |
| 176 | self.encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding. = Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Defaultrust-analyzer cargo xml-rs 0.8.19 util/Encoding#Default#; |
| 177 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().1 && next.is_asciirust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]is_ascii().() { |
| 178 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())); |
| 179 | } |
| 180 | } |
| 181 | }, |
| 182 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Berust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Be# => { |
| 183 | buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = next; |
| 184 | pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 185 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2 { |
| 186 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(c)) = char::decode_utf16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]decode_utf16().([u16::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_be_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().())]).nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/decode/impl#[`DecodeUtf16<I>`][Iterator]next().() { |
| 187 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c)); |
| 188 | } |
| 189 | } else if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().4 { // surrogate |
| 190 | return char::decode_utf16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]decode_utf16().([u16::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_be_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()), u16::from_be_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_be_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().())]) |
| 191 | .nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/decode/impl#[`DecodeUtf16<I>`][Iterator]next().().transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().() |
| 192 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#, e))); |
| 193 | } |
| 194 | }, |
| 195 | Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Lerust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Le# => { |
| 196 | buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut().pos]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`IndexMut<I>`]index_mut(). = next; |
| 197 | pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 198 | if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().2 { |
| 199 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(c)) = char::decode_utf16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]decode_utf16().([u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().())]).nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/decode/impl#[`DecodeUtf16<I>`][Iterator]next().() { |
| 200 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c)); |
| 201 | } |
| 202 | } else if pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().4 { // surrogate |
| 203 | return char::decode_utf16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]decode_utf16().([u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()), u16::from_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]from_le_bytes().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#try_into().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().())]) |
| 204 | .nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/decode/impl#[`DecodeUtf16<I>`][Iterator]next().().transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().() |
| 205 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::InvalidDatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#InvalidData#, e))); |
| 206 | } |
| 207 | }, |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | #[cfg(test)] |
| 214 | mod testsrust-analyzer cargo xml-rs 0.8.19 util/tests/ { |
| 215 | use superrust-analyzer cargo xml-rs 0.8.19 util/::{CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#, CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#, Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#}; |
| 216 | |
| 217 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 218 | fn test_next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/tests/test_next_char_from().() { |
| 219 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/; |
| 220 | |
| 221 | let mut bytes: &[u8] = "correct".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(); // correct ASCII |
| 222 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('c')); |
| 223 | |
| 224 | let mut bytes: &[u8] = b"\xEF\xBB\xBF\xE2\x80\xA2!"; // BOM |
| 225 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('•')); |
| 226 | |
| 227 | let mut bytes: &[u8] = b"\xEF\xBB\xBFx123"; // BOM |
| 228 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('x')); |
| 229 | |
| 230 | let mut bytes: &[u8] = b"\xEF\xBB\xBF"; // Nothing after BOM |
| 231 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 232 | |
| 233 | let mut bytes: &[u8] = b"\xEF\xBB"; // Nothing after BO |
| 234 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#UnexpectedEof#))); |
| 235 | |
| 236 | let mut bytes: &[u8] = b"\xEF\xBB\x42"; // Nothing after BO |
| 237 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_))); |
| 238 | |
| 239 | let mut bytes: &[u8] = b"\xFE\xFF\x00\x42"; // UTF-16 |
| 240 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('B')); |
| 241 | |
| 242 | let mut bytes: &[u8] = b"\xFF\xFE\x42\x00"; // UTF-16 |
| 243 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('B')); |
| 244 | |
| 245 | let mut bytes: &[u8] = b"\xFF\xFE"; // UTF-16 |
| 246 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 247 | |
| 248 | let mut bytes: &[u8] = b"\xFF\xFE\x00"; // UTF-16 |
| 249 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#UnexpectedEof#))); |
| 250 | |
| 251 | let mut bytes: &[u8] = "правильно".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(); // correct BMP |
| 252 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('п')); |
| 253 | |
| 254 | let mut bytes: &[u8] = "правильно".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(); |
| 255 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Berust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Be# }.next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('킿')); |
| 256 | |
| 257 | let mut bytes: &[u8] = "правильно".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(); |
| 258 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Lerust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Le# }.next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('뿐')); |
| 259 | |
| 260 | let mut bytes: &[u8] = b"\xD8\xD8\x80"; |
| 261 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16# }.next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_))); |
| 262 | |
| 263 | let mut bytes: &[u8] = b"\x00\x42"; |
| 264 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16# }.next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('B')); |
| 265 | |
| 266 | let mut bytes: &[u8] = b"\x42\x00"; |
| 267 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16rust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16# }.next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('B')); |
| 268 | |
| 269 | let mut bytes: &[u8] = b"\x00"; |
| 270 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader# { encodingrust-analyzer cargo xml-rs 0.8.19 util/CharReader#encoding.: Encodingrust-analyzer cargo xml-rs 0.8.19 util/Encoding#::Utf16Berust-analyzer cargo xml-rs 0.8.19 util/Encoding#Utf16Be# }.next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_))); |
| 271 | |
| 272 | let mut bytes: &[u8] = "😊".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(); // correct non-BMP |
| 273 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('😊')); |
| 274 | |
| 275 | let mut bytes: &[u8] = b""; // empty |
| 276 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 277 | |
| 278 | let mut bytes: &[u8] = b"\xf0\x9f\x98"; // incomplete code point |
| 279 | match CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().() { |
| 280 | superrust-analyzer cargo xml-rs 0.8.19 util/::CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#UnexpectedEof# => {}, |
| 281 | e => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Unexpected result: {e:?}") |
| 282 | }; |
| 283 | |
| 284 | let mut bytes: &[u8] = b"\xff\x9f\x98\x32"; // invalid code point |
| 285 | match CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut bytes).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().() { |
| 286 | superrust-analyzer cargo xml-rs 0.8.19 util/::CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::Utf8rust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Utf8#(_) => {}, |
| 287 | e => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Unexpected result: {e:?}") |
| 288 | }; |
| 289 | |
| 290 | // error during read |
| 291 | struct ErrorReaderrust-analyzer cargo xml-rs 0.8.19 util/tests/ErrorReader#; |
| 292 | impl iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read# for ErrorReaderrust-analyzer cargo xml-rs 0.8.19 util/tests/ErrorReader# { |
| 293 | fn readrust-analyzer cargo xml-rs 0.8.19 util/tests/impl#[ErrorReader][Read]read().(&mut self, _: &mut [u8]) -> iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> { |
| 294 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::Otherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#Other#, "test error")) |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | let mut r = ErrorReaderrust-analyzer cargo xml-rs 0.8.19 util/tests/ErrorReader#; |
| 299 | match CharReaderrust-analyzer cargo xml-rs 0.8.19 util/CharReader#::newrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]new().().next_char_fromrust-analyzer cargo xml-rs 0.8.19 util/impl#[CharReader]next_char_from().(&mut r).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().() { |
| 300 | superrust-analyzer cargo xml-rs 0.8.19 util/::CharReadErrorrust-analyzer cargo xml-rs 0.8.19 util/CharReadError#::Iorust-analyzer cargo xml-rs 0.8.19 util/CharReadError#Io#(ref e) if e.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().() rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq().==rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq(). rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq().iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::Otherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#Other# && |
| 301 | e.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("test error") => {}, |
| 302 | e => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Unexpected result: {e:?}") |
| 303 | } |
| 304 | } |
| 305 | } |