Macro pasture_core::attributes_as [−][src]
Create an iterator over multiple attributes within a PointBuffer
, supporting type converisons. This macro uses some special syntax
to determine the attributes and their types:
attributes_as!{ ATTRIBUTE_1_EXPR => ATTRIBUTE_1_TYPE, ATTRIBUTE_2_EXPR => ATTRIBUTE_2_TYPE, ..., buffer }
ATTRIBUTE_X_EXPR
must be an expression that evaluates to a &PointAttributeDefinition
and ATTRIBUTE_X_TYPE
must be the Pasture
PrimitiveType
that the attribute will be returned as. This type must be convertible from the actual type that the attribute
is stored with inside buffer
. The iterator will then return tuples of the form:
(ATTRIBUTE_1_TYPE, ATTRIBUTE_2_TYPE, ...)
Note: Currently, a maximum of 4 attributes at the same time are supported.
Panics
Panics if any of the attributes are not contained within the buffer
.
Panics if, for any attribute, no conversion exists between this attributes PointAttributeDataType
and the desired type for this attribute.