Skip to main content

Layout

Trait Layout 

Source
pub trait Layout<T: StyleLayerType>:
    Send
    + Sized
    + 'static {
    type Bucket: Bucket;

    // Required methods
    fn new(cx: &mut LayoutCx<'_, T>) -> Result<Self, Error>;
    fn build(
        self,
        cx: &mut BuildCx<'_, T>,
    ) -> Result<Option<Self::Bucket>, Error>;

    // Provided method
    fn needs_resources(_group: &[Arc<EvaluatedLayer<T>>]) -> bool { ... }
}
Expand description

How a group of layers of the type T that share their layout becomes a tile’s bucket, on a tile worker: new selects the tile’s features, and once the glyphs and images it asked for are resolved, build makes the bucket.

Required Associated Types§

Source

type Bucket: Bucket

The bucket the layout makes.

Required Methods§

Source

fn new(cx: &mut LayoutCx<'_, T>) -> Result<Self, Error>

Selects the features of the tile that the bucket draws.

Source

fn build(self, cx: &mut BuildCx<'_, T>) -> Result<Option<Self::Bucket>, Error>

Makes the bucket of the selected features; None for one with nothing to draw. A feature that fails to decode fails the bucket, which the engine reports as the tile’s error.

Provided Methods§

Source

fn needs_resources(_group: &[Arc<EvaluatedLayer<T>>]) -> bool

Whether the layout of group may ask for glyphs or images. The engine makes such a layout before it resolves them, and builds it once they are, after every other.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§