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

Method as_str_kind

crates/common/src/str.rs:280–290  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

278
279 #[inline]
280 pub fn as_str_kind(&self) -> PyKindStr<'_> {
281 match self.kind {
282 StrKind::Ascii => {
283 PyKindStr::Ascii(unsafe { AsciiStr::from_ascii_unchecked(self.data.as_bytes()) })
284 }
285 StrKind::Utf8 => {
286 PyKindStr::Utf8(unsafe { core::str::from_utf8_unchecked(self.data.as_bytes()) })
287 }
288 StrKind::Wtf8 => PyKindStr::Wtf8(&self.data),
289 }
290 }
291
292 #[inline]
293 pub fn len(&self) -> usize {

Callers 1

nth_charMethod · 0.45

Calls 2

Wtf8Class · 0.85
as_bytesMethod · 0.45

Tested by

no test coverage detected