fn calculate_layout<K, V>(capacity: usize) -> Result<(Layout, usize), LayoutErr> {
    let hashes = Layout::array::<HashUint>(capacity)?;
    let pairs = Layout::array::<(K, V)>(capacity)?;
    hashes.extend(pairs).map(|(layout, _)| {
        // LLVM seems to have trouble properly const-propagating pairs.align(),
        // possibly due to the use of NonZeroUsize. This little hack allows it
        // to generate optimal code.
        //
        // See https://github.com/rust-lang/rust/issues/51346 for more details.
        (
            layout,
            hashes.size() + hashes.padding_needed_for(mem::align_of::<(K, V)>()),
        )
    })
}
// Returns a Layout which describes the allocation required for a hash table,
// and the offset of the array of (key, value) pairs in the allocation.
Returns a Layout which describes the allocation required for a hash table,
and the offset of the array of (key, value) pairs in the allocation.
Returns a Layout which describes the allocation required for a hash table and the offset of the array of ( key value ) pairs in the allocation .
fn calculate_layout<K, V>(capacity: usize) -> Result<(Layout, usize), LayoutErr> {
    let hashes = Layout::array::<HashUint>(capacity)?;
    let pairs = Layout::array::<(K, V)>(capacity)?;
    hashes.extend(pairs).map(|(layout, _)| {
        // LLVM seems to have trouble properly const-propagating pairs.align(),
        // possibly due to the use of NonZeroUsize. This little hack allows it
        // to generate optimal code.
        //
        // See https://github.com/rust-lang/rust/issues/51346 for more details.
        (
            layout,
            hashes.size() + hashes.padding_needed_for(mem::align_of::<(K, V)>()),
        )
    })
}
fn calculate_layout < K , V > ( capacity : usize ) -> Result < ( Layout , usize ) , LayoutErr > { let hashes = Layout :: array :: < HashUint > ( capacity ) ? ; let pairs = Layout :: array :: < ( K , V ) > ( capacity ) ? ; hashes . extend ( pairs ) . map ( | ( layout , _ ) | { // LLVM seems to have trouble properly const-propagating pairs.align(), // possibly due to the use of NonZeroUsize. This little hack allows it // to generate optimal code. // // See https://github.com/rust-lang/rust/issues/51346 for more details. ( layout , hashes . size ( ) + hashes . padding_needed_for ( mem :: align_of :: < ( K , V ) > ( ) ) , ) } ) }
Returns a Layout which describes the allocation required for a hash table,
and the offset of the array of (key, value) pairs in the allocation.
Returns a Layout which describes the allocation required for a hash table and the offset of the array of ( key value ) pairs in the allocation .
capacity
usize