pub struct JsonText {
pub units: Vec<u16>,
pub invalid: Vec<u32>,
pub no_column: Vec<u32>,
}Expand description
A JSON module’s text: UTF-16 units, and the units that stand for bytes
of invalid UTF-8 in the file, which QuickJS’s byte-level parser rejects
with Bad UTF-8 sequence where a token reads them (not in a comment).
Fields§
§units: Vec<u16>§invalid: Vec<u32>Sorted indices into units.
no_column: Vec<u32>Sorted indices of the low halves of four-byte sequences and of stray continuation bytes, which QuickJS’s byte columns do not count (a CESU-8 pair counts twice).
Implementations§
Source§impl JsonText
impl JsonText
Sourcepub fn from_bytes(
bytes: &[u8],
decode: impl Fn(&[u8]) -> Option<(u32, usize)>,
) -> Self
pub fn from_bytes( bytes: &[u8], decode: impl Fn(&[u8]) -> Option<(u32, usize)>, ) -> Self
The text of bytes decoded as QuickJS decodes UTF-8 (lone and
paired surrogates as is); each byte of an invalid sequence becomes
one inert unit marked invalid. decode is QuickJS’s code-point
decoder: the code point and the bytes it used, or None.
Trait Implementations§
impl Eq for JsonText
impl StructuralPartialEq for JsonText
Auto Trait Implementations§
impl Freeze for JsonText
impl RefUnwindSafe for JsonText
impl Send for JsonText
impl Sync for JsonText
impl Unpin for JsonText
impl UnsafeUnpin for JsonText
impl UnwindSafe for JsonText
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more