1 unstable release

0.1.0 Aug 6, 2024

#265 in Memory management

21 downloads per month
Used in 2 crates (via prism-parser)

MIT license

8KB

Bumpalo Try

Allocates a fallible iterator into a bumpalo.

About

Provides the following functions on a bumpalo:

  • fn alloc_slice_fill_with_result<T, E>(&self, len: usize, f: impl FnMut(usize) -> Result<T, E>) -> Result<&mut [T], E>
    
  • fn alloc_slice_fill_with_option<T>(&self, len: usize, mut f: impl FnMut(usize) -> Option<T>) -> Option<&mut [T]>
    
  • fn alloc_slice_fill_iter_result<T, E, I>(&self, iter: I) -> Result<&mut [T], E>
      where
          I: IntoIterator<Item = Result<T, E>>,
          I::IntoIter: ExactSizeIterator
    
  • fn alloc_slice_fill_iter_option<T, I>(&self, iter: I) -> Option<&mut [T]>
      where
          I: IntoIterator<Item = Option<T>>,
          I::IntoIter: ExactSizeIterator
    

These functions will early-exit if the stream of values indicates a failure.

Dependencies

~240KB