pub struct ZeroCopyJson;Expand description
Zero-copy JSON parsing utilities
Implementations§
Source§impl ZeroCopyJson
impl ZeroCopyJson
Sourcepub fn parse_from_slice<T>(input: &mut [u8]) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub fn parse_from_slice<T>(input: &mut [u8]) -> Result<T>where
T: for<'de> Deserialize<'de>,
Parse JSON from a mutable byte slice using zero-copy operations
This function directly parses the input slice, modifying it in place for optimal performance. The input slice will be modified during parsing.
Sourcepub fn parse_from_str<T>(input: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
pub fn parse_from_str<T>(input: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Parse JSON from a string using the unified buffer manager
This function uses the unified buffer manager to avoid allocations while still allowing parsing from immutable string data.
Sourcepub fn parse_to_value(input: &mut [u8]) -> Result<OwnedValue>
pub fn parse_to_value(input: &mut [u8]) -> Result<OwnedValue>
Parse JSON to OwnedValue using zero-copy operations
Sourcepub fn parse_to_borrowed_value<'a>(
input: &'a mut [u8],
) -> Result<BorrowedValue<'a>>
pub fn parse_to_borrowed_value<'a>( input: &'a mut [u8], ) -> Result<BorrowedValue<'a>>
Parse JSON to BorrowedValue for true zero-copy operations
§Safety
The returned BorrowedValue contains references to the input slice, so the input must outlive the returned value.
Sourcepub fn parse_str_to_value(input: &str) -> Result<OwnedValue>
pub fn parse_str_to_value(input: &str) -> Result<OwnedValue>
Parse JSON to OwnedValue from string using unified buffer manager
Sourcepub fn serialize_to_string<T>(value: &T) -> Result<SmartString>where
T: Serialize,
pub fn serialize_to_string<T>(value: &T) -> Result<SmartString>where
T: Serialize,
Serialize to JSON using the unified buffer manager
Sourcepub fn serialize_to_bytes<T>(value: &T) -> Result<Vec<u8>>where
T: Serialize,
pub fn serialize_to_bytes<T>(value: &T) -> Result<Vec<u8>>where
T: Serialize,
Serialize to JSON bytes using the unified buffer manager
Sourcepub fn parse_multiple<T>(
input: &mut [u8],
delimiter: u8,
) -> Result<SmallVec<[T; 8]>>where
T: for<'de> Deserialize<'de>,
pub fn parse_multiple<T>(
input: &mut [u8],
delimiter: u8,
) -> Result<SmallVec<[T; 8]>>where
T: for<'de> Deserialize<'de>,
Parse multiple JSON objects from a byte slice
This is useful for processing streaming JSON data where multiple objects may be concatenated.