Read a marshal string object.
(rdr: &mut R)
| 287 | |
| 288 | /// Read a marshal string object. |
| 289 | fn 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. |
| 306 | fn read_marshal_str_vec<R: Read>(rdr: &mut R) -> Result<Vec<alloc::string::String>> { |
no test coverage detected