pub trait CustomViewRenderer: 'static {
// Required method
fn render_to_rgba(
&self,
view: AnyView,
size: RenderSize,
) -> impl Future<Output = RenderResult>;
}Expand description
Trait for custom view renderers.
Native backends implement this to provide view-to-RGBA capture. The method
returns impl Future, so implementations write a plain async fn — the
object-safe boxing needed to store the renderer in the Environment is an
internal detail of ViewRenderer, never part of this contract.
Required Methods§
Sourcefn render_to_rgba(
&self,
view: AnyView,
size: RenderSize,
) -> impl Future<Output = RenderResult>
fn render_to_rgba( &self, view: AnyView, size: RenderSize, ) -> impl Future<Output = RenderResult>
Render a view to RGBA bytes.
The implementation should:
- Create an offscreen rendering context at the given size
- Render the view hierarchy (native widgets + GPU surfaces)
- Capture the final composited result to RGBA pixels
- Return the pixel data
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".