Trait pasture_core::containers::ColumnarBufferMut

source ·
pub trait ColumnarBufferMut<'a>: ColumnarBuffer<'a> + BorrowedMutBuffer<'a> {
    // Required methods
    fn get_attribute_mut<'b>(
        &'b mut self,
        attribute: &PointAttributeDefinition,
        index: usize,
    ) -> &'b mut [u8] 
       where 'a: 'b;
    fn get_attribute_range_mut<'b>(
        &'b mut self,
        attribute: &PointAttributeDefinition,
        range: Range<usize>,
    ) -> &'b mut [u8] 
       where 'a: 'b;

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

Trait for buffers that store point data in columnar memory layout and also borrow their memory mutably. Compared to ColumnarBuffer, this allows accessing point attributes by mutable reference!

Required Methods§

source

fn get_attribute_mut<'b>( &'b mut self, attribute: &PointAttributeDefinition, index: usize, ) -> &'b mut [u8]
where 'a: 'b,

Get a mutable slice to the memory of the given attribute for the point at index. This is the mutable version of ColumnarBuffer::get_attribute_ref

§Panics

Should panic if attribute is not part of the PointLayout of this buffer.
Should panic if index is out of bounds.

source

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

Get a mutable slice to the memory for the attribute of the given range of points. This is the mutable version of ColumnarBuffer::get_attribute_range_ref

§Panics

Should panic if attribute is not part of the PointLayout of this buffer.
Should panic if range is out of bounds.

Provided Methods§

source

fn view_raw_attribute_mut<'b>( &'b mut self, attribute: &PointAttributeMember, ) -> RawAttributeViewMut<'b>
where 'a: 'b,

Like view_raw_attribute, but returns mutable byte slices of the attribute data

Trait Implementations§

source§

impl<'a> BorrowedBufferExt<'a> for dyn ColumnarBufferMut<'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> BorrowedMutBufferExt<'a> for dyn ColumnarBufferMut<'a> + 'a

source§

fn view_mut<'b, T: PointType>(&'b mut self) -> PointViewMut<'a, 'b, Self, T>
where 'a: 'b,

Get a strongly typed view of the point data of this buffer. This view allows mutating the point data! Read more
source§

fn view_attribute_mut<'b, T: PrimitiveType>( &'b mut self, attribute: &PointAttributeDefinition, ) -> AttributeViewMut<'a, 'b, Self, T>
where 'a: 'b,

Get a strongly typed view of the attribute of all points in this buffer. This view allows mutating the attribute data! Read more
source§

fn transform_attribute<'b, T: PrimitiveType, F: Fn(usize, T) -> T>( &'b mut self, attribute: &PointAttributeDefinition, func: F, )
where 'a: 'b,

Apply a transformation function to the given attribute of all points within this buffer. This function is helpful if you want to modify a single attribute of a buffer in-place and works for buffers of all memory layouts. For columnar buffers, prefer using get_attribute_range_mut to modify attribute data in-place. Read more
source§

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

§

type SliceType = BufferSliceColumnar<'a, dyn ColumnarBufferMut<'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
source§

impl<'a> SliceBufferMut<'a> for dyn ColumnarBufferMut<'a> + 'a

§

type SliceTypeMut = BufferSliceColumnarMut<'a, dyn ColumnarBufferMut<'a> + 'a>

source§

fn slice_mut(&'a mut self, range: Range<usize>) -> Self::SliceTypeMut

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

Implementors§