FIX: Fix serde feature for const gen

This commit is contained in:
bluss
2021-03-23 17:49:11 +01:00
parent c9b095f263
commit 6daae9ae68
5 changed files with 22 additions and 25 deletions
+3 -3
View File
@@ -1141,17 +1141,17 @@ impl<'de, T: Deserialize<'de>, const CAP: usize> Deserialize<'de> for ArrayVec<T
type Value = ArrayVec<T, CAP>;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "an array with no more than {} items", A::CAPACITY)
write!(formatter, "an array with no more than {} items", CAP)
}
fn visit_seq<SA>(self, mut seq: SA) -> Result<Self::Value, SA::Error>
where SA: SeqAccess<'de>,
{
let mut values = ArrayVec::<A>::new();
let mut values = ArrayVec::<T, CAP>::new();
while let Some(value) = seq.next_element()? {
if let Err(_) = values.try_push(value) {
return Err(SA::Error::invalid_length(A::CAPACITY + 1, &self));
return Err(SA::Error::invalid_length(CAP + 1, &self));
}
}