Trait pasture_core::containers::InterleavedBuffer

source ·
pub trait InterleavedBuffer<'a>: BorrowedBuffer<'a> {
    // Required methods
    fn get_point_ref<'b>(&'b self, index: usize) -> &'b [u8] 
       where 'a: 'b;
    fn get_point_range_ref<'b>(&'b self, range: Range<usize>) -> &'b [u8] 
       where 'a: 'b;

    // Provided method
    fn view_raw_attribute<'b>(
        &'b self,
        attribute: &PointAttributeMember,
    ) -> RawAttributeView<'b>
       where 'a: 'b { ... }
}
Expand description

Trait for point buffers that store their point data in interleaved memory layout. This allows accessing point data by reference

Required Methods§

source

fn get_point_ref<'b>(&'b self, index: usize) -> &'b [u8]
where 'a: 'b,

Get an immutable slice of the point memory of the point at index

§Lifetimes

Has a more relaxed lifetime bound than the underlying buffer, since we should be able to borrow point data for a lifetime 'b that is potentially shorter than the lifetime 'a of the BorrowedBuffer

§Panics

Should panic if index is out of bounds

source

fn get_point_range_ref<'b>(&'b self, range: Range<usize>) -> &'b [u8]
where 'a: 'b,

Get an immutable slice of the memory for the given range of points. This is the range-version of [get_point_ref], see its documentation for more details

§Panics

If range is out of bounds

Provided Methods§

source

fn view_raw_attribute<'b>( &'b self, attribute: &PointAttributeMember, ) -> RawAttributeView<'b>
where 'a: 'b,

Get a raw view over the given attribute from this point buffer. Unlike the typed view that view_attribute returns, this view dereferences to byte slices, but it is potentially more efficient to use than calling get_attribute repeatedly

Trait Implementations§

source§

impl<'a> BorrowedBufferExt<'a> for dyn InterleavedBuffer<'a> + 'a

source§

fn view<'b, T: PointType>(&'b self) -> PointView<'a, 'b, Self, T>
where 'a: 'b,

Get a strongly typed view of the point data of this buffer Read more
source§

fn view_attribute<'b, T: PrimitiveType>( &'b self, attribute: &PointAttributeDefinition, ) -> AttributeView<'a, 'b, Self, T>
where 'a: 'b,

Gets a strongly typed view of the attribute of all points in this buffer Read more
source§

fn view_attribute_with_conversion<'b, T: PrimitiveType>( &'b self, attribute: &PointAttributeDefinition, ) -> Result<AttributeViewConverting<'a, 'b, Self, T>>
where 'a: 'b,

Like view_attribute, but allows T::data_type() to be different from the data type of
the attribute within this buffer. Read more
source§

impl<'a> SliceBuffer<'a> for dyn InterleavedBuffer<'a> + 'a

§

type SliceType = BufferSliceInterleaved<'a, dyn InterleavedBuffer<'a> + 'a>

The slice type
source§

fn slice(&'a self, range: Range<usize>) -> Self::SliceType

Take a immutable slice to this buffer using the given range of points Read more

Implementors§