Trait pasture_core::containers::InterleavedBufferMut
source · pub trait InterleavedBufferMut<'a>: InterleavedBuffer<'a> + BorrowedMutBuffer<'a> {
// Required methods
fn get_point_mut<'b>(&'b mut self, index: usize) -> &'b mut [u8] ⓘ
where 'a: 'b;
fn get_point_range_mut<'b>(
&'b mut self,
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 interleaved memory layout and also borrow their memory mutably. Compared
to InterleavedBuffer
, this allows accessing point data by mutable reference!
Required Methods§
sourcefn get_point_mut<'b>(&'b mut self, index: usize) -> &'b mut [u8] ⓘwhere
'a: 'b,
fn get_point_mut<'b>(&'b mut self, index: usize) -> &'b mut [u8] ⓘwhere
'a: 'b,
Get a mutable slice of the point memory of the point at index
. This is the mutable version of InterleavedBuffer::get_point_ref
§Panics
Should panic if index
is out of bounds
sourcefn get_point_range_mut<'b>(&'b mut self, range: Range<usize>) -> &'b mut [u8] ⓘwhere
'a: 'b,
fn get_point_range_mut<'b>(&'b mut self, range: Range<usize>) -> &'b mut [u8] ⓘwhere
'a: 'b,
Get a mutable slice of the memory for the given range
of points. This is the mutable version of InterleavedBuffer::get_point_range_ref
§Panics
Should panic if index
is out of bounds
Provided Methods§
sourcefn view_raw_attribute_mut<'b>(
&'b mut self,
attribute: &PointAttributeMember,
) -> RawAttributeViewMut<'b>where
'a: 'b,
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 InterleavedBufferMut<'a> + 'a
impl<'a> BorrowedBufferExt<'a> for dyn InterleavedBufferMut<'a> + 'a
source§fn view<'b, T: PointType>(&'b self) -> PointView<'a, 'b, Self, T>where
'a: 'b,
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,
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 moresource§fn view_attribute_with_conversion<'b, T: PrimitiveType>(
&'b self,
attribute: &PointAttributeDefinition,
) -> Result<AttributeViewConverting<'a, 'b, Self, T>>where
'a: 'b,
fn view_attribute_with_conversion<'b, T: PrimitiveType>(
&'b self,
attribute: &PointAttributeDefinition,
) -> Result<AttributeViewConverting<'a, 'b, Self, T>>where
'a: 'b,
Like
the
view_attribute
, but allows T::data_type()
to be different from the data type ofthe
attribute
within this buffer. Read moresource§impl<'a> BorrowedMutBufferExt<'a> for dyn InterleavedBufferMut<'a> + 'a
impl<'a> BorrowedMutBufferExt<'a> for dyn InterleavedBufferMut<'a> + 'a
source§fn view_mut<'b, T: PointType>(&'b mut self) -> PointViewMut<'a, 'b, Self, T>where
'a: 'b,
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,
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 moresource§fn transform_attribute<'b, T: PrimitiveType, F: Fn(usize, T) -> T>(
&'b mut self,
attribute: &PointAttributeDefinition,
func: F,
)where
'a: 'b,
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