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

Function read_marshal_str

crates/compiler-core/src/marshal.rs:289–303  ·  view source on GitHub ↗

Read a marshal string object.

(rdr: &mut R)

Source from the content-addressed store, hash-verified

287
288/// Read a marshal string object.
289fn read_marshal_str<R: Read>(rdr: &mut R) -> Result<alloc::string::String> {
290 let type_byte = rdr.read_u8()? & !FLAG_REF;
291 let s = match type_byte {
292 b'u' | b't' | b'a' | b'A' => {
293 let len = rdr.read_u32()?;
294 rdr.read_str(len)?
295 }
296 b'z' | b'Z' => {
297 let len = rdr.read_u8()? as u32;
298 rdr.read_str(len)?
299 }
300 _ => return Err(MarshalError::BadType),
301 };
302 Ok(alloc::string::String::from(s))
303}
304
305/// Read a marshal tuple of strings, returning owned Strings.
306fn read_marshal_str_vec<R: Read>(rdr: &mut R) -> Result<Vec<alloc::string::String>> {

Callers 3

deserialize_codeFunction · 0.85
read_marshal_str_vecFunction · 0.85
read_marshal_name_tupleFunction · 0.85

Calls 4

read_u8Method · 0.80
read_u32Method · 0.80
read_strMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected