1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[cfg(any(feature = "std", feature = "alloc"))]
use crate::de::SizeHint;

#[cfg(any(feature = "std", feature = "alloc"))]
#[inline]
pub(crate) fn cautious<S>(hint: S) -> usize
where
    SizeHint: From<S>,
{
    match SizeHint::from(hint) {
        SizeHint::Any => 0,
        SizeHint::Exact(n) => n.min(4096),
    }
}