pub fn alloc_lazy_slice<'arena, T, I: Iterator<Item=T>>(&'arena self, vals: I, n: usize) -> &'arena [T] {
      // Grab space for `n` elements even if it may turn out we have to walk it back
      let ptr = self.require(n * size_of::<T>()) as *mut T;
      let mut i: usize = 0; 

      unsafe {
        use std::slice::from_raw_parts;

        for val in vals.take(n) {
          *ptr.offset(i as isize) = val;
          i += 1;
        }
        // Now fix the slice length and arena offset
        let diff = n - i;
        self.reset_to( self.offset() - diff * size_of::<T>() );
        from_raw_parts(ptr, i)
      }
    }
/// Allocate a statically-sized but lazily-generated slice `[T]` out of an iterator
/// This is useful if you're going to make a slice of something and put it on the arena,
/// but you don't want to make an allocation first just to have something to copy in.
///
/// The slice will be at maximum length `n`, further elements of the iterator ignored and not evaluated.
/// If the iterator yields less than `n` elements, a shorter slice will simply be returned.
Allocate a statically-sized but lazily-generated slice `[T]` out of an iterator
This is useful if you're going to make a slice of something and put it on the arena,
but you don't want to make an allocation first just to have something to copy in.

The slice will be at maximum length `n`, further elements of the iterator ignored and not evaluated.
If the iterator yields less than `n` elements, a shorter slice will simply be returned.
Allocate a statically - sized but lazily - generated slice ` [ T ] ` out of an iterator This is useful if you ' re going to make a slice of something and put it on the arena but you don ' t want to make an allocation first just to have something to copy in . The slice will be at maximum length ` n ` further elements of the iterator ignored and not evaluated . If the iterator yields less than ` n ` elements a shorter slice will simply be returned .
pub fn alloc_lazy_slice<'arena, T, I: Iterator<Item=T>>(&'arena self, vals: I, n: usize) -> &'arena [T] {
      // Grab space for `n` elements even if it may turn out we have to walk it back
      let ptr = self.require(n * size_of::<T>()) as *mut T;
      let mut i: usize = 0; 
      unsafe {
        use std::slice::from_raw_parts;
        for val in vals.take(n) {
          *ptr.offset(i as isize) = val;
          i += 1;
        }
        // Now fix the slice length and arena offset
        let diff = n - i;
        self.reset_to( self.offset() - diff * size_of::<T>() );
        from_raw_parts(ptr, i)
      }
    }
pub fn alloc_lazy_slice < ' arena , T , I : Iterator < Item = T > > ( & ' arena self , vals : I , n : usize ) -> & ' arena [ T ] { // Grab space for `n` elements even if it may turn out we have to walk it back let ptr = self . require ( n * size_of :: < T > ( ) ) as * mut T ; let mut i : usize = 0 ; unsafe { use std :: slice :: from_raw_parts ; for val in vals . take ( n ) { * ptr . offset ( i as isize ) = val ; i += 1 ; } // Now fix the slice length and arena offset let diff = n - i ; self . reset_to ( self . offset ( ) - diff * size_of :: < T > ( ) ) ; from_raw_parts ( ptr , i ) } }
Allocate a statically-sized but lazily-generated slice `[T]` out of an iterator
This is useful if you're going to make a slice of something and put it on the arena,
but you don't want to make an allocation first just to have something to copy in.
Allocate a statically - sized but lazily - generated slice ` [ T ] ` out of an iterator This is useful if you ' re going to make a slice of something and put it on the arena but you don ' t want to make an allocation first just to have something to copy in .
&'arena self
vals
I
n
usize
&'arena self
vals
I
n
usize