pub trait HostSurface: Send + Sync {
// Provided methods
fn can_resize(&self) -> bool { ... }
fn request_size(&self, width: f32, height: f32) -> Result<(), ResizeRefused> { ... }
}Expand description
What an application may ask of the host’s surface.
The surface’s size is not asked of a backend: every host publishes it as
it lays the surface out, and host_surface_size answers from that. What a
backend adds is the other direction — whether this host lets the application
choose a size, and how to ask for one.
Provided Methods§
Sourcefn can_resize(&self) -> bool
fn can_resize(&self) -> bool
Whether this host accepts resize requests at all.
Sourcefn request_size(&self, width: f32, height: f32) -> Result<(), ResizeRefused>
fn request_size(&self, width: f32, height: f32) -> Result<(), ResizeRefused>
Asks the host for a different surface size.
Hosts are free to clamp or ignore the request, so the answer is only “the request was accepted”: the size that actually took effect arrives through the observable state.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".