pub trait BinderValue:
Clone
+ Default
+ ValueConverter
+ StatisticValue
+ Debug {
const DIMENSIONS: usize;
const BASE_DATA_TYPE: AttributeDataType;
const INTERPOLATED_DATA_TYPE: AttributeDataType;
// Required method
fn attribute_value(&self) -> [f32; 2];
}Expand description
The value types of data-driven paint properties with a single attribute
(float and Color in circle, fill and line): the attribute’s value of
a value (attribute_value), and its type.
Required Associated Constants§
Sourceconst DIMENSIONS: usize
const DIMENSIONS: usize
The number of floats attribute_value uses.
Sourceconst BASE_DATA_TYPE: AttributeDataType
const BASE_DATA_TYPE: AttributeDataType
The attribute’s type for a value that doesn’t change with the zoom.
Sourceconst INTERPOLATED_DATA_TYPE: AttributeDataType
const INTERPOLATED_DATA_TYPE: AttributeDataType
The attribute’s type for a value interpolated between two zooms.
Required Methods§
Sourcefn attribute_value(&self) -> [f32; 2]
fn attribute_value(&self) -> [f32; 2]
The attribute’s floats; only the first DIMENSIONS entries are used.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl BinderValue for Color
impl BinderValue for Color
Source§fn attribute_value(&self) -> [f32; 2]
fn attribute_value(&self) -> [f32; 2]
Encode a four-component color value into a pair of floats, with 8 bits for each component: for each float we use the upper 8 bits for one component (e.g. (color.r * 255) * 256), and the lower 8 for another.
Also note that colors come in as floats 0..1, so we scale by 255.