Struct pasture_core::containers::BufferSlice
source · pub struct BufferSlice<'a, T: BorrowedBuffer<'a>> { /* private fields */ }
Expand description
An immutable slice to a point buffer. In terms of memory layout, the slice will have the same
capabilities as the underlying buffer, i.e. if T
implements InterleavedBuffer
, so does this
slice, and similar for the other memory layout traits.
Implementations§
source§impl<'a, T: BorrowedBuffer<'a>> BufferSlice<'a, T>
impl<'a, T: BorrowedBuffer<'a>> BufferSlice<'a, T>
Trait Implementations§
source§impl<'a, T: BorrowedBuffer<'a>> BorrowedBuffer<'a> for BufferSlice<'a, T>
impl<'a, T: BorrowedBuffer<'a>> BorrowedBuffer<'a> for BufferSlice<'a, T>
source§fn point_layout(&self) -> &PointLayout
fn point_layout(&self) -> &PointLayout
Returns the
PointLayout
of this buffer. The PointLayout
describes the structure of a single
point at runtime. Read moresource§fn get_attribute(
&self,
attribute: &PointAttributeDefinition,
index: usize,
data: &mut [u8]
)
fn get_attribute( &self, attribute: &PointAttributeDefinition, index: usize, data: &mut [u8] )
source§unsafe fn get_attribute_unchecked(
&self,
attribute_member: &PointAttributeMember,
index: usize,
data: &mut [u8]
)
unsafe fn get_attribute_unchecked( &self, attribute_member: &PointAttributeMember, index: usize, data: &mut [u8] )
Like
get_attribute
, but performs no check whether the attribute actually is part of this buffers PointLayout
or not. Because of this, this function accepts a PointAttributeMember
instead of a PointAttributeDefinition
,
and this PointAttributeMember
must come from the PointLayout
of this buffer! The benefit over get_attribute
is that this function skips the include checks and thus will be faster if you repeatedly want to get data for a
single attribute Read moresource§fn get_attribute_range(
&self,
attribute: &PointAttributeDefinition,
point_range: Range<usize>,
data: &mut [u8]
)
fn get_attribute_range( &self, attribute: &PointAttributeDefinition, point_range: Range<usize>, data: &mut [u8] )
Writes the data for the given
attribute
of the given range of points into data
. The attribute data will
be tightly packed in data
, irregardless of the memory layout of this buffer. The attribute values might not
be correctly aligned, if the alignment requirement of attribute.datatype()
is larger than the size of the
attribute. All of the built-in attributes in pasture have alignments that are less than or equal to their size,
so for built-in attributes you can assume that the attributes in data
are correctly aligned. Read moresource§fn view<'b, T: PointType>(&'b self) -> PointView<'a, 'b, Self, T>where
Self: Sized,
'a: 'b,
fn view<'b, T: PointType>(&'b self) -> PointView<'a, 'b, Self, T>where
Self: Sized,
'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
Self: Sized,
'a: 'b,
fn view_attribute<'b, T: PrimitiveType>(
&'b self,
attribute: &PointAttributeDefinition
) -> AttributeView<'a, 'b, Self, T>where
Self: Sized,
'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
Self: Sized,
'a: 'b,
fn view_attribute_with_conversion<'b, T: PrimitiveType>(
&'b self,
attribute: &PointAttributeDefinition
) -> Result<AttributeViewConverting<'a, 'b, Self, T>>where
Self: Sized,
'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§fn as_interleaved(&self) -> Option<&dyn InterleavedBuffer<'a>>
fn as_interleaved(&self) -> Option<&dyn InterleavedBuffer<'a>>
Try to get a reference to
self
as an InterleavedBuffer
. Returns None
if self
does not
implement InterleavedBuffer
source§fn as_columnar(&self) -> Option<&dyn ColumnarBuffer<'a>>
fn as_columnar(&self) -> Option<&dyn ColumnarBuffer<'a>>
Try to get a reference to
self
as a ColumnarBuffer
. Returns None
if self
does not
implement ColumnarBuffer
source§impl<'a, T: ColumnarBuffer<'a>> ColumnarBuffer<'a> for BufferSlice<'a, T>
impl<'a, T: ColumnarBuffer<'a>> ColumnarBuffer<'a> for BufferSlice<'a, T>
source§fn get_attribute_ref<'c>(
&'c self,
attribute: &PointAttributeDefinition,
index: usize
) -> &'c [u8] ⓘwhere
'a: 'c,
fn get_attribute_ref<'c>(
&'c self,
attribute: &PointAttributeDefinition,
index: usize
) -> &'c [u8] ⓘwhere
'a: 'c,
Get an immutable slice to the memory of the given
attribute
for the point at index
. See InterleavedBuffer::get_point_ref
for an explanation of the lifetime bounds. Read moresource§fn get_attribute_range_ref<'c>(
&'c self,
attribute: &PointAttributeDefinition,
range: Range<usize>
) -> &'c [u8] ⓘwhere
'a: 'c,
fn get_attribute_range_ref<'c>(
&'c self,
attribute: &PointAttributeDefinition,
range: Range<usize>
) -> &'c [u8] ⓘwhere
'a: 'c,
source§fn view_raw_attribute<'b>(
&'b self,
attribute: &PointAttributeMember
) -> RawAttributeView<'b>where
'a: 'b,
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
repeatedlysource§impl<'a, T: InterleavedBuffer<'a>> InterleavedBuffer<'a> for BufferSlice<'a, T>
impl<'a, T: InterleavedBuffer<'a>> InterleavedBuffer<'a> for BufferSlice<'a, T>
source§fn get_point_ref<'c>(&'c self, index: usize) -> &'c [u8] ⓘwhere
'a: 'c,
fn get_point_ref<'c>(&'c self, index: usize) -> &'c [u8] ⓘwhere
'a: 'c,
Get an immutable slice of the point memory of the point at
index
Read moresource§fn get_point_range_ref<'c>(&'c self, range: Range<usize>) -> &'c [u8] ⓘwhere
'a: 'c,
fn get_point_range_ref<'c>(&'c self, range: Range<usize>) -> &'c [u8] ⓘwhere
'a: 'c,
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 Read moresource§fn view_raw_attribute<'b>(
&'b self,
attribute: &PointAttributeMember
) -> RawAttributeView<'b>where
'a: 'b,
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
repeatedlysource§impl<'a, T: BorrowedBuffer<'a> + Sized> SliceBuffer<'a> for BufferSlice<'a, T>
impl<'a, T: BorrowedBuffer<'a> + Sized> SliceBuffer<'a> for BufferSlice<'a, T>
§type SliceType = BufferSlice<'a, T>
type SliceType = BufferSlice<'a, T>
The slice type
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for BufferSlice<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for BufferSlice<'a, T>where
T: Sync,
impl<'a, T> Sync for BufferSlice<'a, T>where
T: Sync,
impl<'a, T> Unpin for BufferSlice<'a, T>
impl<'a, T> UnwindSafe for BufferSlice<'a, T>where
T: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.