MCPcopy Index your code
hub / github.com/RustPython/RustPython / make_decode_err

Function make_decode_err

crates/common/src/encodings.rs:140–152  ·  view source on GitHub ↗

# Safety `v[..valid_up_to]` must be valid utf8

(
    v: &[u8],
    valid_up_to: usize,
    err_len: Option<usize>,
)

Source from the content-addressed store, hash-verified

138/// # Safety
139/// `v[..valid_up_to]` must be valid utf8
140const unsafe fn make_decode_err(
141 v: &[u8],
142 valid_up_to: usize,
143 err_len: Option<usize>,
144) -> DecodeError<'_> {
145 let (valid_prefix, rest) = unsafe { v.split_at_unchecked(valid_up_to) };
146 let valid_prefix = unsafe { core::str::from_utf8_unchecked(valid_prefix) };
147 DecodeError {
148 valid_prefix,
149 rest,
150 err_len,
151 }
152}
153
154enum HandleResult<'a> {
155 Done,

Callers 1

decodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected