Skip to main content

surface_wasmtime/
lib.rs

1mod surface;
2pub use surface::{
3    add_to_linker as add_surface_to_linker, MainThreadSpawner, Surface, SurfaceCtx, SurfaceCtxView,
4    SurfaceDesc,
5};
6
7#[cfg(feature = "winit")]
8pub mod winit;
9
10#[cfg(feature = "surface-webgpu")]
11mod surface_webgpu;
12#[cfg(feature = "surface-webgpu")]
13pub use surface_webgpu::{
14    add_to_linker as add_surface_webgpu_to_linker, SurfaceWebgpuCtx, SurfaceWebgpuCtxView,
15};
16
17#[cfg(feature = "surface-frame-buffer")]
18mod surface_frame_buffer;
19#[cfg(feature = "surface-frame-buffer")]
20pub use surface_frame_buffer::{
21    add_to_linker as add_surface_frame_buffer_to_linker, SurfaceFrameBufferCtx,
22    SurfaceFrameBufferCtxView,
23};
24
25/// Add surface, surface-webgpu, surface-frame-buffer to the linker
26#[cfg(all(feature = "surface-webgpu", feature = "surface-frame-buffer"))]
27pub fn add_all_to_linker<T>(l: &mut wasmtime::component::Linker<T>) -> wasmtime::Result<()>
28where
29    T: SurfaceCtxView + SurfaceWebgpuCtxView + SurfaceFrameBufferCtxView,
30{
31    add_surface_to_linker(l)?;
32    add_surface_webgpu_to_linker(l)?;
33    add_surface_frame_buffer_to_linker(l)?;
34    Ok(())
35}