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

Method from_bytes

crates/wtf8/src/lib.rs:314–319  ·  view source on GitHub ↗

Create a WTF-8 string from a WTF-8 byte vec.

(value: Vec<u8>)

Source from the content-addressed store, hash-verified

312
313 /// Create a WTF-8 string from a WTF-8 byte vec.
314 pub fn from_bytes(value: Vec<u8>) -> Result<Self, Vec<u8>> {
315 match Wtf8::from_bytes(&value) {
316 Some(_) => Ok(unsafe { Self::from_bytes_unchecked(value) }),
317 None => Err(value),
318 }
319 }
320
321 /// Creates a WTF-8 string from a UTF-8 `String`.
322 ///

Callers 15

_read_intsMethod · 0.45
_read_objectMethod · 0.45
_ip_int_from_stringMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
seedMethod · 0.45
randomMethod · 0.45
getrandbitsMethod · 0.45
decode_longFunction · 0.45
print_instructionMethod · 0.45
__init__Method · 0.45
_random_getnodeFunction · 0.45

Calls 3

decode_surrogateFunction · 0.85
ErrClass · 0.50
SomeClass · 0.50

Tested by 15

test_from_bytesMethod · 0.36
checkMethod · 0.36
test_from_bytesMethod · 0.36
test_from_bytes_smallMethod · 0.36
test_as_prefixMethod · 0.36
read_count_signaledMethod · 0.36
buffer_like_objectsMethod · 0.36