Silk

silk/json_text

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.

Decoding validated JSON string tokens into owned UTF-8 bytes.

When to use

Use JsonText.decode after JsonScanner has validated a string token. The returned bytes are valid UTF-8 and can be adopted by String without another copy.

Import as JsonText with import silk.json_text { JsonText }.

Public declarations: 1.

JsonText

pub struct JsonText

Operations on validated JSON string token text.

Associated function JsonText.copy

pub effect<'life0> fn copy<'life0>(raw: &'life0 [u8]) -> Bytes ! OutOfMemoryError ? &mut Allocator

Copies scanner-validated UTF-8 or ASCII bytes into owned storage.

Associated function JsonText.decode

pub effect<'life0> fn decode<'life0>(raw: &'life0 [u8], offset: usize, escaped: bool) -> Bytes ! JsonError | OutOfMemoryError ? &mut Allocator

Decodes one quoted token, including escapes, into owned valid UTF-8 bytes.

On this page