| 1 | //! UTF-8 utilities taken from `core::str`, Rust 1.81. |
| 2 | |
| 3 | #[inline] |
| 4 | const fn utf8_first_byterust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_first_byte().(byte: u8, width: u32) -> u32 { |
| 5 | (byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().(0x7F rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<u32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<u32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<u32>`]shr().width)) as u32 |
| 6 | } |
| 7 | |
| 8 | #[inline] |
| 9 | const fn utf8_acc_cont_byterust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_acc_cont_byte().(ch: u32, byte: u8) -> u32 { |
| 10 | (ch rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().6) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().(byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().CONT_MASKrust-analyzer cargo fluent-uri 0.4.1 utf8/CONT_MASK.) as u32 |
| 11 | } |
| 12 | |
| 13 | #[inline] |
| 14 | pub const fn next_code_pointrust-analyzer cargo fluent-uri 0.4.1 utf8/next_code_point().(bytes: &[u8], i: usize) -> (u32, usize) { |
| 15 | let x = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 16 | if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().128 { |
| 17 | return (x as u32, 1); |
| 18 | } |
| 19 | |
| 20 | let init = utf8_first_byterust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_first_byte().(x, 2); |
| 21 | let y = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 22 | if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().0xE0 { |
| 23 | (utf8_acc_cont_byterust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_acc_cont_byte().(init, y), 2) |
| 24 | } else { |
| 25 | let z = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 26 | let y_z = utf8_acc_cont_byterust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_acc_cont_byte().((y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().CONT_MASKrust-analyzer cargo fluent-uri 0.4.1 utf8/CONT_MASK.) as u32, z); |
| 27 | if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().0xF0 { |
| 28 | ((init rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().12) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().y_z, 3) |
| 29 | } else { |
| 30 | let w = bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 31 | (((init rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().7) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shl<i32>`]shl().18) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().utf8_acc_cont_byterust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_acc_cont_byte().(y_z, w), 4) |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | #[cfg(feature = "alloc")] |
| 37 | const UTF8_CHAR_WIDTHrust-analyzer cargo fluent-uri 0.4.1 utf8/UTF8_CHAR_WIDTH.: &[u8; 256] = &[ |
| 38 | // 1 2 3 4 5 6 7 8 9 A B C D E F |
| 39 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0 |
| 40 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 |
| 41 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2 |
| 42 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3 |
| 43 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4 |
| 44 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5 |
| 45 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6 |
| 46 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7 |
| 47 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8 |
| 48 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9 |
| 49 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A |
| 50 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B |
| 51 | 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C |
| 52 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // D |
| 53 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // E |
| 54 | 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // F |
| 55 | ]; |
| 56 | |
| 57 | #[cfg(feature = "alloc")] |
| 58 | #[inline] |
| 59 | const fn utf8_char_widthrust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_char_width().(b: u8) -> usize { |
| 60 | UTF8_CHAR_WIDTHrust-analyzer cargo fluent-uri 0.4.1 utf8/UTF8_CHAR_WIDTH.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().b as usize]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). as usize |
| 61 | } |
| 62 | |
| 63 | const CONT_MASKrust-analyzer cargo fluent-uri 0.4.1 utf8/CONT_MASK.: u8 = 0b0011_1111; |
| 64 | |
| 65 | #[cfg(feature = "alloc")] |
| 66 | pub struct Utf8Chunkrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#<'a> { |
| 67 | validrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#valid.: &'a str, |
| 68 | invalidrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#invalid.: &'a [u8], |
| 69 | incompleterust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#incomplete.: bool, |
| 70 | } |
| 71 | |
| 72 | #[cfg(feature = "alloc")] |
| 73 | impl<'a> Utf8Chunkrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#<'a> { |
| 74 | pub fn validrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunk<'a>`]valid().(&self) -> &'a str { |
| 75 | self.validrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#valid. |
| 76 | } |
| 77 | |
| 78 | pub fn invalidrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunk<'a>`]invalid().(&self) -> &'a [u8] { |
| 79 | self.invalidrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#invalid. |
| 80 | } |
| 81 | |
| 82 | pub fn incompleterust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunk<'a>`]incomplete().(&self) -> bool { |
| 83 | self.incompleterust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#incomplete. |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | #[cfg(feature = "alloc")] |
| 88 | pub struct Utf8Chunksrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#<'a> { |
| 89 | sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source.: &'a [u8], |
| 90 | } |
| 91 | |
| 92 | #[cfg(feature = "alloc")] |
| 93 | impl<'a> Utf8Chunksrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#<'a> { |
| 94 | pub fn newrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunks<'a>`]new().(bytes: &'a [u8]) -> Selfrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunks<'a>`] { |
| 95 | Selfrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunks<'a>`] { sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source.: bytes } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | #[cfg(feature = "alloc")] |
| 100 | impl<'a> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Utf8Chunksrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#<'a> { |
| 101 | type Itemrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunks<'a>`][Iterator]Item# = Utf8Chunkrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#<'a>; |
| 102 | |
| 103 | fn nextrust-analyzer cargo fluent-uri 0.4.1 utf8/impl#[`Utf8Chunks<'a>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Utf8Chunkrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#<'a>> { |
| 104 | if self.sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source..is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() { |
| 105 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 106 | } |
| 107 | |
| 108 | const TAG_CONT_U8rust-analyzer cargo fluent-uri 0.4.1 utf8/TAG_CONT_U8.: u8 = 128; |
| 109 | |
| 110 | let mut incomplete = false; |
| 111 | let mut safe_get = |i| match self.sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source..getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(i) { |
| 112 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().x, |
| 113 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 114 | incomplete = true; |
| 115 | 0 |
| 116 | } |
| 117 | }; |
| 118 | |
| 119 | let mut i = 0; |
| 120 | let mut valid_up_to = 0; |
| 121 | while i 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().self.sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 122 | let byte = self.sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 123 | i 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; |
| 124 | |
| 125 | if byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().128 { |
| 126 | let w = utf8_char_widthrust-analyzer cargo fluent-uri 0.4.1 utf8/utf8_char_width().(byte); |
| 127 | |
| 128 | match w { |
| 129 | 2 => { |
| 130 | if safe_get(i) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().192 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().TAG_CONT_U8rust-analyzer cargo fluent-uri 0.4.1 utf8/TAG_CONT_U8. { |
| 131 | break; |
| 132 | } |
| 133 | i 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 | 3 => { |
| 136 | match (byte, safe_get(i)) { |
| 137 | (0xE0, 0xA0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xBF) => (), |
| 138 | (0xE1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xEC, 0x80..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xBF) => (), |
| 139 | (0xED, 0x80..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0x9F) => (), |
| 140 | (0xEE..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xEF, 0x80..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xBF) => (), |
| 141 | _ => break, |
| 142 | } |
| 143 | i 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; |
| 144 | if safe_get(i) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().192 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().TAG_CONT_U8rust-analyzer cargo fluent-uri 0.4.1 utf8/TAG_CONT_U8. { |
| 145 | break; |
| 146 | } |
| 147 | i 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; |
| 148 | } |
| 149 | 4 => { |
| 150 | match (byte, safe_get(i)) { |
| 151 | (0xF0, 0x90..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xBF) => (), |
| 152 | (0xF1..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xF3, 0x80..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0xBF) => (), |
| 153 | (0xF4, 0x80..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0x8F) => (), |
| 154 | _ => break, |
| 155 | } |
| 156 | i 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; |
| 157 | if safe_get(i) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().192 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().TAG_CONT_U8rust-analyzer cargo fluent-uri 0.4.1 utf8/TAG_CONT_U8. { |
| 158 | break; |
| 159 | } |
| 160 | i 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; |
| 161 | if safe_get(i) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().192 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().TAG_CONT_U8rust-analyzer cargo fluent-uri 0.4.1 utf8/TAG_CONT_U8. { |
| 162 | break; |
| 163 | } |
| 164 | i 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; |
| 165 | } |
| 166 | _ => break, |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | valid_up_to = i; |
| 171 | } |
| 172 | |
| 173 | let (inspected, remaining) = self.sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source..split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(i); |
| 174 | self.sourcerust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunks#source. = remaining; |
| 175 | |
| 176 | let (valid, invalid) = inspected.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(valid_up_to); |
| 177 | |
| 178 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Utf8Chunkrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk# { |
| 179 | validrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#valid.: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(valid).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 180 | invalidrust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#invalid., |
| 181 | incompleterust-analyzer cargo fluent-uri 0.4.1 utf8/Utf8Chunk#incomplete., |
| 182 | }) |
| 183 | } |
| 184 | } |