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::Background;
use crate::property::table::{PropertyInfo, PropertyTable, PropertyVisitor};

crate::properties!(
    /// The paint properties of a background layer.
    #[expect(non_snake_case, reason = "named as a type: the module stands for the layer's set of properties")]
    pub mod BackgroundPaintProperties: paint {
        background_color: constant Color = Color::black(),
        background_opacity: constant f32 = 1.0_f32,
        background_pattern: cross_faded Image = Image::default(),
    }
    use crate::color::Color, crate::expression::Image;
);

/// The properties, by slot.
pub(crate) static PROPERTIES: PropertyTable = PropertyTable::new(
    &[
        PropertyInfo::paint("background-color"),
        PropertyInfo::paint("background-opacity"),
        PropertyInfo::paint("background-pattern"),
    ],
    &[0, 1, 2],
);

/// Calls `visitor` with the field of the property in `slot`.
pub(crate) fn visit<V: PropertyVisitor<LayerStyle<Background>>>(slot: usize, visitor: V) -> Option<V::Output> {
    Some(match slot {
        0 => visitor.paint(|s| &s.paint.background_color, |s| &mut s.paint.background_color),
        1 => visitor.paint(|s| &s.paint.background_opacity, |s| &mut s.paint.background_opacity),
        2 => visitor.paint(|s| &s.paint.background_pattern, |s| &mut s.paint.background_pattern),
        _ => return None,
    })
}