# RenderCommand in maplibre::render::render_phase::draw - Rust
[`RenderCommand`] is a trait that runs an ECS query and produces one or more [`TrackedRenderPass`] calls. Types implementing this trait can be composed (as tuples).
Keywords: rust, rustlang, rust-lang, RenderCommand

# Trait maplibre::render::render_phase::draw::RenderCommand

source · [−]

    pub trait RenderCommand<P: PhaseItem> {
        fn render<'w>(
            state: &'w RenderState,
            item: &P,
            pass: &mut TrackedRenderPass<'w>
        ) -> RenderCommandResult;
    }

Expand description

`RenderCommand` is a trait that runs an ECS query and produces one or more `TrackedRenderPass` calls. Types implementing this trait can be composed (as tuples).

They can be registered as a `Draw` function via the [`AddRenderCommand::add_render_command`] method.

## Example

The `DrawPbr` draw function is created from the following render command tuple. Const generics are used to set specific bind group locations:

ⓘ

    pub type DrawPbr = (
        SetItemPipeline,
        SetMeshViewBindGroup<0>,
        SetStandardMaterialBindGroup<1>,
        SetTransformBindGroup<2>,
        DrawMesh,
    );

## Required methods

source

#### fn render<'w>(
state: &'w RenderState,
item: &P,
pass: &mut TrackedRenderPass<'w>
) -> RenderCommandResult

Renders the `PhaseItem` by issuing draw calls via the `TrackedRenderPass`.

## Implementations on Foreign Types

source

### impl<P: PhaseItem, C0: RenderCommand<P>> RenderCommand<P> for (C0,)

source

#### fn render<'w>(
_state: &'w RenderState,
_item: &P,
_pass: &mut TrackedRenderPass<'w>
) -> RenderCommandResult

source

### impl<P: PhaseItem, C0: RenderCommand<P>, C1: RenderCommand<P>> RenderCommand<P> for (C0, C1)

source

#### fn render<'w>(
_state: &'w RenderState,
_item: &P,
_pass: &mut TrackedRenderPass<'w>
) -> RenderCommandResult

source

### impl<P: PhaseItem, C0: RenderCommand<P>, C1: RenderCommand<P>, C2: RenderCommand<P>> RenderCommand<P> for (C0, C1, C2)

source

#### fn render<'w>(
_state: &'w RenderState,
_item: &P,
_pass: &mut TrackedRenderPass<'w>
) -> RenderCommandResult

source

### impl<P: PhaseItem, C0: RenderCommand<P>, C1: RenderCommand<P>, C2: RenderCommand<P>, C3: RenderCommand<P>> RenderCommand<P> for (C0, C1, C2, C3)

source

#### fn render<'w>(
_state: &'w RenderState,
_item: &P,
_pass: &mut TrackedRenderPass<'w>
) -> RenderCommandResult

source

### impl<P: PhaseItem, C0: RenderCommand<P>, C1: RenderCommand<P>, C2: RenderCommand<P>, C3: RenderCommand<P>, C4: RenderCommand<P>> RenderCommand<P> for (C0, C1, C2, C3, C4)

source

#### fn render<'w>(
_state: &'w RenderState,
_item: &P,
_pass: &mut TrackedRenderPass<'w>
) -> RenderCommandResult

## Implementors

source

### impl RenderCommand<( IndexEntry, TileShape )> for DrawTile

source

### impl RenderCommand<TileInView> for DrawMask

source

### impl<P: PhaseItem> RenderCommand<P> for SetMaskPipeline

source

### impl<P: PhaseItem> RenderCommand<P> for SetTilePipeline

source

### impl<const I: usize, P: PhaseItem> RenderCommand<P> for SetViewBindGroup<I>