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

Method new_str_unchecked

crates/common/src/str.rs:237–243  ·  view source on GitHub ↗

# Safety Given `bytes` must be valid data for given `kind`

(data: Box<Wtf8>, kind: StrKind)

Source from the content-addressed store, hash-verified

235 ///
236 /// Given `bytes` must be valid data for given `kind`
237 pub unsafe fn new_str_unchecked(data: Box<Wtf8>, kind: StrKind) -> Self {
238 let len = match kind {
239 StrKind::Ascii => data.len().into(),
240 _ => StrLen::uncomputed(),
241 };
242 Self { data, kind, len }
243 }
244
245 /// # Safety
246 ///

Callers

nothing calls this directly

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected