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

Method into_string

crates/wtf8/src/lib.rs:535–541  ·  view source on GitHub ↗

Consumes the WTF-8 string and tries to convert it to UTF-8. This does not copy the data. If the contents are not well-formed UTF-8 (that is, if the string contains surrogates), the original WTF-8 string is returned instead.

(self)

Source from the content-addressed store, hash-verified

533 /// (that is, if the string contains surrogates),
534 /// the original WTF-8 string is returned instead.
535 pub fn into_string(self) -> Result<String, Wtf8Buf> {
536 if self.is_utf8() {
537 Ok(unsafe { String::from_utf8_unchecked(self.bytes) })
538 } else {
539 Err(self)
540 }
541 }
542
543 /// Consumes the WTF-8 string and converts it lossily to UTF-8.
544 ///

Callers 10

criterion_benchmarkFunction · 0.80
get_pathsFunction · 0.80
collect_stdlib_pathsFunction · 0.80
gethostnameFunction · 0.80
from_unistd_groupMethod · 0.80
fromMethod · 0.80
fromMethod · 0.80
getwindowsversionFunction · 0.80
ttynameFunction · 0.80
fsdecodeMethod · 0.80

Calls 2

ErrClass · 0.50
is_utf8Method · 0.45

Tested by 1

fromMethod · 0.64