use crate::de::SizeHint;
#[inline]
pub(crate) fn cautious<T>(hint: impl Into<SizeHint>) -> usize {
const MAX_PREALLOC_BYTES: usize = 1024 * 1024;
if size_of::<T>() == 0 {
return 0;
}
hint.into()
.or_default()
.min(MAX_PREALLOC_BYTES / size_of::<T>())
}