# sort_phase_system.rs - source
Source of the Rust file `maplibre/src/render/systems/sort_phase_system.rs`.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14

    use crate::{
        context::MapContext,
        render::render_phase::{LayerItem, RenderPhase},
    };

    /// This system sorts all [`RenderPhases`](RenderPhase) for the [`PhaseItem`] type.
    pub fn sort_phase_system(MapContext { world, .. }: &mut MapContext) {
        // We are only sorting layers and not masks
        world
            .resources
            .get_mut::<RenderPhase<LayerItem>>()
            .unwrap()
            .sort();
    }