unsafe fn new_uninitialized_internal(
        capacity: usize,
        fallibility: Fallibility,
    ) -> Result<RawTable<K, V>, CollectionAllocErr> {
        if capacity == 0 {
            return Ok(RawTable {
                size: 0,
                capacity_mask: capacity.wrapping_sub(1),
                hashes: TaggedHashUintPtr::new(EMPTY as *mut HashUint),
                marker: marker::PhantomData,
            });
        }

        // Allocating hashmaps is a little tricky. We need to allocate two
        // arrays, but since we know their sizes and alignments up front,
        // we just allocate a single array, and then have the subarrays
        // point into it.
        let (layout, _) = calculate_layout::<K, V>(capacity)?;
        let buffer = Global.alloc(layout).map_err(|e| match fallibility {
            Infallible => handle_alloc_error(layout),
            Fallible => e,
        })?;

        Ok(RawTable {
            capacity_mask: capacity.wrapping_sub(1),
            size: 0,
            hashes: TaggedHashUintPtr::new(buffer.cast().as_ptr()),
            marker: marker::PhantomData,
        })
    }
/// Does not initialize the buckets. The caller should ensure they,
/// at the very least, set every hash to EMPTY_BUCKET.
/// Returns an error if it cannot allocate or capacity overflows.
Does not initialize the buckets. The caller should ensure they,
at the very least, set every hash to EMPTY_BUCKET.
Returns an error if it cannot allocate or capacity overflows.
Does not initialize the buckets . The caller should ensure they at the very least set every hash to EMPTY_BUCKET . Returns an error if it cannot allocate or capacity overflows .
unsafe fn new_uninitialized_internal(
        capacity: usize,
        fallibility: Fallibility,
    ) -> Result<RawTable<K, V>, CollectionAllocErr> {
        if capacity == 0 {
            return Ok(RawTable {
                size: 0,
                capacity_mask: capacity.wrapping_sub(1),
                hashes: TaggedHashUintPtr::new(EMPTY as *mut HashUint),
                marker: marker::PhantomData,
            });
        }
        // Allocating hashmaps is a little tricky. We need to allocate two
        // arrays, but since we know their sizes and alignments up front,
        // we just allocate a single array, and then have the subarrays
        // point into it.
        let (layout, _) = calculate_layout::<K, V>(capacity)?;
        let buffer = Global.alloc(layout).map_err(|e| match fallibility {
            Infallible => handle_alloc_error(layout),
            Fallible => e,
        })?;
        Ok(RawTable {
            capacity_mask: capacity.wrapping_sub(1),
            size: 0,
            hashes: TaggedHashUintPtr::new(buffer.cast().as_ptr()),
            marker: marker::PhantomData,
        })
    }
unsafe fn new_uninitialized_internal ( capacity : usize , fallibility : Fallibility , ) -> Result < RawTable < K , V > , CollectionAllocErr > { if capacity == 0 { return Ok ( RawTable { size : 0 , capacity_mask : capacity . wrapping_sub ( 1 ) , hashes : TaggedHashUintPtr :: new ( EMPTY as * mut HashUint ) , marker : marker :: PhantomData , } ) ; } // Allocating hashmaps is a little tricky. We need to allocate two // arrays, but since we know their sizes and alignments up front, // we just allocate a single array, and then have the subarrays // point into it. let ( layout , _ ) = calculate_layout :: < K , V > ( capacity ) ? ; let buffer = Global . alloc ( layout ) . map_err ( | e | match fallibility { Infallible => handle_alloc_error ( layout ) , Fallible => e , } ) ? ; Ok ( RawTable { capacity_mask : capacity . wrapping_sub ( 1 ) , size : 0 , hashes : TaggedHashUintPtr :: new ( buffer . cast ( ) . as_ptr ( ) ) , marker : marker :: PhantomData , } ) }
Does not initialize the buckets.
Does not initialize the buckets .
capacity
usize
fallibility
Fallibility