musli_core/internal/
size_hint.rs

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

#[cfg(feature = "alloc")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
#[inline]
pub(crate) fn cautious<S>(hint: S) -> usize
where
    SizeHint: From<S>,
{
    SizeHint::from(hint).or_default().min(4096)
}