MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / string_from_utf8

Function string_from_utf8

debugger/src/reader.rs:422–435  ·  view source on GitHub ↗
(mut bytes: Vec<u8>)

Source from the content-addressed store, hash-verified

420}
421
422fn string_from_utf8(mut bytes: Vec<u8>) -> Option<String> {
423 // we'd truncate the raw bytes when sending
424 // so the last char may be incomplete
425 for _ in 0..4 {
426 match String::from_utf8(bytes) {
427 Ok(s) => return Some(s),
428 Err(e) => {
429 bytes = e.into_bytes();
430 bytes.pop();
431 }
432 }
433 }
434 None
435}

Callers 2

strlit_vMethod · 0.85
struct_vMethod · 0.85

Calls 1

into_bytesMethod · 0.80

Tested by

no test coverage detected