HeadlessRenderer

Trait HeadlessRenderer 

Source
pub trait HeadlessRenderer {
    // Required methods
    fn update(
        &mut self,
        read_tickets: Layers<ReadTicket<'_>>,
        cursor: Option<&Cursor>,
    ) -> Result<(), RenderError>;
    fn draw<'a>(
        &'a mut self,
        info_text: &'a str,
    ) -> BoxFuture<'a, Result<Rendering, RenderError>>;
}
Expand description

Rendering a previously-specified scene to an in-memory image.

This trait is object-safe so that different renderers can be used without generics. Therefore, all its async methods use boxed futures.

Required Methods§

Source

fn update( &mut self, read_tickets: Layers<ReadTicket<'_>>, cursor: Option<&Cursor>, ) -> Result<(), RenderError>

Update the renderer’s internal copy of the scene from the data sources (Handle<Character> etc.) it is tracking.

Returns RenderError::Read if said sources are in use or if some other prohibitive failure occurred. The resulting state of the renderer in such cases is not specified, but a good implementation should attempt recovery on a future call.

Source

fn draw<'a>( &'a mut self, info_text: &'a str, ) -> BoxFuture<'a, Result<Rendering, RenderError>>

Produce an image of the current state of the scene this renderer was created to track, as of the last call to Self::update(), with the given overlaid text.

This operation should not attempt to access the scene objects and therefore may be called while the Universe is being stepped on another thread.

Implementors§

Source§

impl HeadlessRenderer for RtRenderer<()>

Available on crate feature std only.

This implementation is only available if the std feature is enabled.