Skip to main content

value_from_bytes

Function value_from_bytes 

Source
pub fn value_from_bytes(
    bytes: Vec<u8>,
    span: Span,
    type_: ByteStreamType,
    trim_trailing_newline: bool,
) -> Value
Expand description

Convert already-collected stream bytes into a Value.

Shared by ByteStream::into_value (for ByteStreamType::Unknown) and interactive last-result capture of a byte-stream prefix.

Incomplete multi-byte sequences at the end (typical when a prefix is truncated to a budget) keep the valid UTF-8 prefix as a string rather than failing the whole buffer to binary.

When trim_trailing_newline is true, a single trailing \n or \r\n is stripped, matching collected external/file values.