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§
sourcefn get_attribute_mut<'b>(
&'b mut self,
attribute: &PointAttributeDefinition,
index: usize,
) -> &'b mut [u8] ⓘwhere
'a: 'b,
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.
sourcefn get_attribute_range_mut<'b>(
&'b mut self,
attribute: &PointAttributeDefinition,
range: Range<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,
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§
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 ColumnarBufferMut<'a> + 'a
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,
fn view<'b, T: PointType>(&'b self) -> PointView<'a, 'b, Self, T>where
'a: 'b,
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,
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,
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 ColumnarBufferMut<'a> + 'a
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,
fn view_mut<'b, T: PointType>(&'b mut self) -> PointViewMut<'a, 'b, Self, T>where
'a: 'b,
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,
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,
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