logo
pub unsafe trait IndexSlice<'a, V, I, W, S>: Tess<V, I, W, S> where
    V: TessVertexData<S>,
    I: TessIndex,
    W: TessVertexData<S>,
    S: ?Sized
{ type IndexSliceRepr: 'a + Deref<Target = [I]>; type IndexSliceMutRepr: 'a + DerefMut<Target = [I]>; unsafe fn indices(
        tess: &'a mut Self::TessRepr
    ) -> Result<Self::IndexSliceRepr, TessMapError>; unsafe fn indices_mut(
        tess: &'a mut Self::TessRepr
    ) -> Result<Self::IndexSliceMutRepr, TessMapError>; }
Expand description

Slice index data on CPU.

This trait must be implemented by the backend so that it’s possible to slice the index data. The idea is that the index storage is backend-dependent; the backend can decide to cache the data, or not, and we should assume the data to live in a memory that is costly to access. For this reason, slicing the index data requires to get an object on which one can use Deref (and possibly DerefMut). The IndexSlice::indices and IndexSlice::indices_mut methods must get such objects. Implementations will typically map memory regions and retain the mapped data until the IndexSlice::IndexSliceRepr and IndexSlice::IndexSliceMutRepr objects are dropped (c.f. Drop).

Associated Types

Backend representation of an immutable index slice.

Backend representation of a mutable index slice.

Required methods

Obtain an immutable index slice.

Even though this method returns an immutable slice, it has to mutably borrow the tessellation to prevent having two immutable slices living at the same time. This is a limitation that some backends might need.

Obtain a mutable index slice.

Implementors