Skip to main content

SetFromSliceFn

Type Alias SetFromSliceFn 

Source
pub type SetFromSliceFn = unsafe extern "C" fn(set: PtrUninit, elements_ptr: *mut u8, count: usize) -> PtrMut;
Expand description

Build a set from a contiguous slice of elements.

This is an optimization for batch construction - instead of calling insert N times, collect elements in a buffer and build the set in one shot.

ยงSafety

  • set must point to uninitialized memory of sufficient size for the set type
  • elements_ptr must point to count consecutive initialized elements
  • Each element has size T::SHAPE.layout.size() (the element stride)
  • After this call, the elements have been moved into the set and should NOT be dropped