(
f: &mut std::fmt::Formatter<'_>,
fields: &IndexMap<String, RValue>,
width: usize,
pretty: bool,
)
| 648 | } |
| 649 | |
| 650 | fn print_os_string( |
| 651 | f: &mut std::fmt::Formatter<'_>, |
| 652 | fields: &IndexMap<String, RValue>, |
| 653 | width: usize, |
| 654 | pretty: bool, |
| 655 | ) -> std::fmt::Result { |
| 656 | write!(f, "{}::from_encoded_bytes_unchecked(", STD_OS_STRING)?; |
| 657 | if pretty { |
| 658 | write!( |
| 659 | f, |
| 660 | "\n{}", |
| 661 | String::from_utf8(vec![b' '; (width + 1) * 4]).unwrap() |
| 662 | )?; |
| 663 | } |
| 664 | let inner = match fields.get("inner") { |
| 665 | Some(RValue::Struct { fields, .. }) => { |
| 666 | if let Some(inner) = fields.get("inner") { |
| 667 | match inner { |
| 668 | RValue::Bytes { value, .. } => value, |
| 669 | _ => { |
| 670 | write!(f, "?)")?; |
| 671 | return Ok(()); |
| 672 | } |
| 673 | } |
| 674 | } else { |
| 675 | write!(f, "?)")?; |
| 676 | return Ok(()); |
| 677 | } |
| 678 | } |
| 679 | _ => { |
| 680 | write!(f, "?)")?; |
| 681 | return Ok(()); |
| 682 | } |
| 683 | }; |
| 684 | if let Ok(string) = std::str::from_utf8(inner) { |
| 685 | write!(f, "String::from({:?}).into_bytes()", string)?; |
| 686 | } else { |
| 687 | write!(f, "vec!")?; |
| 688 | print_bytes(f, inner)?; |
| 689 | } |
| 690 | if pretty { |
| 691 | write!(f, "\n{}", String::from_utf8(vec![b' '; width * 4]).unwrap())?; |
| 692 | } |
| 693 | write!(f, ")")?; |
| 694 | Ok(()) |
| 695 | } |
| 696 | |
| 697 | fn print_arr_items( |
| 698 | f: &mut std::fmt::Formatter<'_>, |
no test coverage detected