(&mut self, input: &mut &'a [u8], length: usize)
| 61 | |
| 62 | impl<'a> View<'a> for SerdeDecoder<'a> { |
| 63 | fn populate(&mut self, input: &mut &'a [u8], length: usize) -> Result<()> { |
| 64 | match self { |
| 65 | Self::Bool(d) => d.populate(input, length), |
| 66 | Self::Enum(d) => { |
| 67 | d.0.populate(input, length)?; |
| 68 | if let Some(max_variant_index) = d.0.max_variant_index() { |
| 69 | get_mut_or_resize(&mut d.1, max_variant_index as usize); |
| 70 | d.1.iter_mut() |
| 71 | .enumerate() |
| 72 | .try_for_each(|(i, variant)| variant.populate(input, d.0.length(i as u8))) |
| 73 | } else { |
| 74 | Ok(()) |
| 75 | } |
| 76 | } |
| 77 | Self::F32(d) => d.populate(input, length), |
| 78 | Self::Map(d) => { |
| 79 | d.0.populate(input, length)?; |
| 80 | let length = d.0.length(); |
| 81 | d.1 .0.populate(input, length)?; |
| 82 | d.1 .1.populate(input, length) |
| 83 | } |
| 84 | Self::Seq(d) => { |
| 85 | d.0.populate(input, length)?; |
| 86 | let length = d.0.length(); |
| 87 | d.1.populate(input, length) |
| 88 | } |
| 89 | Self::Str(d) => d.populate(input, length), |
| 90 | Self::Tuple(d) => d.iter_mut().try_for_each(|d| d.populate(input, length)), |
| 91 | Self::U8(d) => d.populate(input, length), |
| 92 | Self::U16(d) => d.populate(input, length), |
| 93 | Self::U32(d) => d.populate(input, length), |
| 94 | Self::U64(d) => d.populate(input, length), |
| 95 | Self::U128(d) => d.populate(input, length), |
| 96 | Self::Unpopulated => { |
| 97 | *self = Self::Unspecified { length }; |
| 98 | Ok(()) |
| 99 | } |
| 100 | Self::Unspecified { .. } => unreachable!(), |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | struct DecoderWrapper<'a, 'de> { |
no test coverage detected