Fix no_index build.

This commit is contained in:
Stephen Chung 2021-12-18 18:44:08 +08:00
parent 541ef319bb
commit e507dcfcb4

View File

@ -2074,6 +2074,7 @@ impl Dynamic {
}
/// Convert the [`Dynamic`] into a [`Vec`].
/// Returns the name of the actual type if any cast fails.
#[cfg(not(feature = "no_index"))]
#[inline(always)]
pub fn into_typed_array<T: Variant + Clone>(self) -> Result<Vec<T>, &'static str> {
match self.0 {
@ -2121,6 +2122,9 @@ impl Dynamic {
})
.collect()
}
Union::Blob(_, _, _) if TypeId::of::<T>() == TypeId::of::<u8>() => {
Ok((*value).clone().cast::<Vec<T>>())
}
_ => Err((*value).type_name()),
}
}