Function recursion_guard
pub fn recursion_guard(
depth: usize,
f: impl FnOnce(usize) -> (usize, Option<usize>),
) -> (usize, Option<usize>)👎Deprecated:
use try_recursion_guard instead
Available on crate features
arbitrary only.Expand description
Protects against potential infinite recursion when calculating size hints due to indirect type recursion.
When the depth is not too deep, calls f with depth + 1 to calculate the
size hint.
Otherwise, returns the default size hint: (0, None).
This method is deprecated. Users should instead implement
try_size_hint and use try_recursion_guard