Struct RenderEngine

Source
pub struct RenderEngine { /* private fields */ }
Expand description

A mapping of Element to Renderers used to delegate rendering of generic Segments via their Element. Only one Renderer per type is allowed in the current implementation.

Implementations§

Source§

impl RenderEngine

Source

pub fn new() -> RenderEngine

Creates an empty RenderEngine.

Source

pub fn add_renderer<R: Renderer + 'static>(&mut self, renderer: R)

Adds a Renderer to this RenderEngine, replacing any existing Renderer for the corresponding Renderer::Element.

Source

pub fn can_render(&self, element: &dyn Element) -> bool

Determines if this RenderEngine can render a given &dyn Element. (i.e. whether it has a mapped renderer for the given &dyn Element)

This checks not only the given &dyn Element, but also any types it wraps.

Source

pub fn can_render_specific(&self, element: &dyn Element) -> bool

Determines if this RenderEngine can render a given &dyn Element. Only checks the given type, ignoring any wrapped types (unlike Self::can_render).

Source

pub fn render( &self, segment: &Segment, context: CompositionContext<'_>, ) -> Option<Result<Vec<Segment>>>

Renders a Element over a given time range with supplied context, delegating to Renderers mapped to its type and wrapped types if any. If no mapped Renderer for the type or wrapped types exists, None is returned.

Trait Implementations§

Source§

impl<R, S> Add<R> for RenderEngine
where R: Renderer<Element = S> + 'static, S: Element,

Source§

type Output = RenderEngine

The resulting type after applying the + operator.
Source§

fn add(self, rhs: R) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for RenderEngine

Source§

type Output = RenderEngine

The resulting type after applying the + operator.
Source§

fn add(self, rhs: RenderEngine) -> Self::Output

Performs the + operation. Read more
Source§

impl Debug for RenderEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RenderEngine

Source§

fn default() -> RenderEngine

Returns the “default value” for a type. Read more
Source§

impl From<RenderEngine> for Composer

Source§

fn from(value: RenderEngine) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V