Trait Renderer

Source
pub trait Renderer {
    type Element: Element;

    // Required method
    fn render(
        &self,
        segment: SegmentRef<'_, Self::Element>,
        context: CompositionContext<'_>,
    ) -> Result<Vec<Segment>, RendererError>;
}
Expand description

Defines render behavior for a specific Element.

Every render operation during composition receives a SegmentRef<Self::Element> with CompositionContext and may return Vec<Segment> on success, or RendererError::MissingContext in the case that its render dependencies are not satisfied (which will be retried later).

Required Associated Types§

Source

type Element: Element

The particular Element this Renderer renders.

Required Methods§

Source

fn render( &self, segment: SegmentRef<'_, Self::Element>, context: CompositionContext<'_>, ) -> Result<Vec<Segment>, RendererError>

Renderers a SegmentRef<Self::Element> with CompositionContext, returning additional Segments as children.

Implementors§

Source§

impl<T> Renderer for AdhocRenderer<T>
where T: Element,

Source§

impl<T> Renderer for RendererGroup<T>
where T: Element,