mln-rs-style 0.0.21

Part of mln-rs, a MapLibre map renderer written in Rust. Depend on mln-rs instead.
Documentation
// This file is generated by //tools/style-codegen from the style spec
// (tools/style-codegen/v8.json). Do not edit.

use crate::layer::LayerStyle;
use crate::layers::Circle;
use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};

crate::properties!(
    /// The layout properties of a circle layer.
    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
    pub mod CircleLayoutProperties: layout {
        circle_sort_key: data_driven f32 = 0.0_f32,
    }
);

crate::properties!(
    /// The paint properties of a circle layer.
    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
    pub mod CirclePaintProperties: paint {
        circle_blur: data_driven f32 = 0.0_f32,
        circle_color: data_driven Color = Color::black(),
        circle_opacity: data_driven f32 = 1.0_f32,
        circle_pitch_alignment: constant AlignmentType = AlignmentType::Viewport,
        circle_pitch_scale: constant CirclePitchScaleType = CirclePitchScaleType::Map,
        circle_radius: data_driven f32 = 5.0_f32,
        circle_stroke_color: data_driven Color = Color::black(),
        circle_stroke_opacity: data_driven f32 = 1.0_f32,
        circle_stroke_width: data_driven f32 = 0.0_f32,
        circle_translate: constant [f32; 2] = [0.0_f32, 0.0_f32],
        circle_translate_anchor: constant TranslateAnchorType = TranslateAnchorType::Map,
    }
    use crate::color::Color, crate::types::AlignmentType, crate::types::CirclePitchScaleType, crate::types::TranslateAnchorType;
);

/// The properties, by slot.
pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
    &[
        PropertyInfo::paint("circle-blur").data_driven(),
        PropertyInfo::paint("circle-color").data_driven(),
        PropertyInfo::paint("circle-opacity").data_driven(),
        PropertyInfo::paint("circle-pitch-alignment"),
        PropertyInfo::paint("circle-pitch-scale"),
        PropertyInfo::paint("circle-radius").data_driven(),
        PropertyInfo::paint("circle-stroke-color").data_driven(),
        PropertyInfo::paint("circle-stroke-opacity").data_driven(),
        PropertyInfo::paint("circle-stroke-width").data_driven(),
        PropertyInfo::paint("circle-translate"),
        PropertyInfo::paint("circle-translate-anchor"),
        PropertyInfo::layout("circle-sort-key").data_driven(),
    ],
    &[0, 1, 2, 3, 4, 5, 11, 6, 7, 8, 9, 10],
);

/// Calls `visitor` with the field of the property in `slot`.
pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Circle>>>(slot: usize, visitor: V) -> Option<V::Output> {
    Some(match slot {
        0 => visitor.paint(|s| &s.paint.circle_blur, |s| &mut s.paint.circle_blur),
        1 => visitor.paint(|s| &s.paint.circle_color, |s| &mut s.paint.circle_color),
        2 => visitor.paint(|s| &s.paint.circle_opacity, |s| &mut s.paint.circle_opacity),
        3 => visitor.paint(|s| &s.paint.circle_pitch_alignment, |s| &mut s.paint.circle_pitch_alignment),
        4 => visitor.paint(|s| &s.paint.circle_pitch_scale, |s| &mut s.paint.circle_pitch_scale),
        5 => visitor.paint(|s| &s.paint.circle_radius, |s| &mut s.paint.circle_radius),
        6 => visitor.paint(|s| &s.paint.circle_stroke_color, |s| &mut s.paint.circle_stroke_color),
        7 => visitor.paint(|s| &s.paint.circle_stroke_opacity, |s| &mut s.paint.circle_stroke_opacity),
        8 => visitor.paint(|s| &s.paint.circle_stroke_width, |s| &mut s.paint.circle_stroke_width),
        9 => visitor.paint(|s| &s.paint.circle_translate, |s| &mut s.paint.circle_translate),
        10 => visitor.paint(|s| &s.paint.circle_translate_anchor, |s| &mut s.paint.circle_translate_anchor),
        11 => visitor.layout(|s| &s.layout.circle_sort_key, |s| &mut s.layout.circle_sort_key),
        _ => return None,
    })
}