Skip to main content

alloc_filled

Function alloc_filled 

Source
pub fn alloc_filled<T: Clone>(
    count: usize,
    value: T,
    operation: &'static str,
) -> Result<Vec<T>, CodecError>
Expand description

Allocates count copies of value with try_reserve_exact and no panic on OOM.

Use [DecodeContext::alloc_filled] when a decode session can also charge collection items. This helper is for call sites that only need the allocation bound.