pub struct HeadlessPlatform { /* private fields */ }Expand description
Deterministic offscreen platform backend available on all targets for CI and pixel-parity testing.
Implementations§
Source§impl HeadlessPlatform
Configuration and event injection helpers for HeadlessPlatform.
impl HeadlessPlatform
Configuration and event injection helpers for HeadlessPlatform.
Sourcepub fn emulating(
platform: PlatformKind,
scale_factor: f32,
safe_area: SafeAreaInsets,
) -> Self
pub fn emulating( platform: PlatformKind, scale_factor: f32, safe_area: SafeAreaInsets, ) -> Self
Sourcepub fn push_event(&mut self, event: WindowEvent)
pub fn push_event(&mut self, event: WindowEvent)
Enqueues a synthetic WindowEvent to be consumed on the next poll_events() call.
§Arguments
&Self- Mutable headless platform.WindowEvent- Synthetic event to inject.
Sourcepub fn last_framebuffer(&self, id: WindowId) -> Option<&Framebuffer>
pub fn last_framebuffer(&self, id: WindowId) -> Option<&Framebuffer>
Source§impl HeadlessPlatform
impl HeadlessPlatform
pub fn get_emulated_kind(&self) -> PlatformKind
pub fn get_mut_emulated_kind(&mut self) -> &mut PlatformKind
pub fn set_emulated_kind(&mut self, val: PlatformKind) -> &mut Self
pub fn get_scale_factor(&self) -> f32
pub fn get_mut_scale_factor(&mut self) -> &mut f32
pub fn set_scale_factor(&mut self, val: f32) -> &mut Self
pub fn get_safe_area(&self) -> SafeAreaInsets
pub fn get_mut_safe_area(&mut self) -> &mut SafeAreaInsets
pub fn set_safe_area(&mut self, val: SafeAreaInsets) -> &mut Self
pub fn get_theme(&self) -> ThemeMode
pub fn get_mut_theme(&mut self) -> &mut ThemeMode
pub fn set_theme(&mut self, val: ThemeMode) -> &mut Self
pub fn get_windows(&self) -> &HashMap<WindowId, HeadlessWindowRecord>
pub fn get_mut_windows( &mut self, ) -> &mut HashMap<WindowId, HeadlessWindowRecord>
pub fn set_windows( &mut self, val: HashMap<WindowId, HeadlessWindowRecord>, ) -> &mut Self
pub fn get_pending_events(&self) -> &Vec<WindowEvent>
pub fn get_mut_pending_events(&mut self) -> &mut Vec<WindowEvent>
pub fn set_pending_events(&mut self, val: Vec<WindowEvent>) -> &mut Self
pub fn get_mut_clipboard(&mut self) -> &mut Option<String>
pub fn set_clipboard(&mut self, val: Option<String>) -> &mut Self
Trait Implementations§
Source§impl Clone for HeadlessPlatform
impl Clone for HeadlessPlatform
Source§impl Debug for HeadlessPlatform
impl Debug for HeadlessPlatform
Source§impl Default for HeadlessPlatform
Default HeadlessPlatform at 1.0x scale and Light theme.
impl Default for HeadlessPlatform
Default HeadlessPlatform at 1.0x scale and Light theme.
Source§impl PlatformBackend for HeadlessPlatform
PlatformBackend implementation for HeadlessPlatform.
impl PlatformBackend for HeadlessPlatform
PlatformBackend implementation for HeadlessPlatform.
Source§fn kind(&self) -> PlatformKind
fn kind(&self) -> PlatformKind
Source§fn capabilities(&self) -> PlatformCapabilities
fn capabilities(&self) -> PlatformCapabilities
Source§fn create_window(
&mut self,
config: &WindowConfig,
) -> Result<WindowState, PlatformError>
fn create_window( &mut self, config: &WindowConfig, ) -> Result<WindowState, PlatformError>
Source§fn window_state(&self, id: WindowId) -> Option<WindowState>
fn window_state(&self, id: WindowId) -> Option<WindowState>
Source§fn raw_window_handle(&self, _id: WindowId) -> RawWindowHandle
fn raw_window_handle(&self, _id: WindowId) -> RawWindowHandle
Source§fn poll_events(&mut self) -> Vec<WindowEvent>
fn poll_events(&mut self) -> Vec<WindowEvent>
Source§fn present_framebuffer(
&mut self,
id: WindowId,
framebuffer: &Framebuffer,
) -> Result<(), PlatformError>
fn present_framebuffer( &mut self, id: WindowId, framebuffer: &Framebuffer, ) -> Result<(), PlatformError>
Source§fn read_clipboard(&self) -> Option<String>
fn read_clipboard(&self) -> Option<String>
Source§fn write_clipboard(&mut self, text: &str) -> Result<(), PlatformError>
fn write_clipboard(&mut self, text: &str) -> Result<(), PlatformError>
Source§fn system_theme(&self) -> ThemeMode
fn system_theme(&self) -> ThemeMode
Source§fn present_framebuffer_region(
&mut self,
id: WindowId,
framebuffer: &Framebuffer,
_damage: DamageRegion,
) -> Result<(), PlatformError>
fn present_framebuffer_region( &mut self, id: WindowId, framebuffer: &Framebuffer, _damage: DamageRegion, ) -> Result<(), PlatformError>
Presents a damaged sub-region of a CPU-rendered RGBA8
Framebuffer when supported by the backend. Read moreSource§fn display_refresh_rate_hz(&self) -> f32
fn display_refresh_rate_hz(&self) -> f32
Queries the active display’s native hardware refresh rate in Hertz (
60.0 fallback). Read moreSource§impl WindowController for HeadlessPlatform
WindowController implementation for HeadlessPlatform.
impl WindowController for HeadlessPlatform
WindowController implementation for HeadlessPlatform.
Source§fn apply_command(&mut self, command: WindowCommand) -> Result<(), PlatformError>
fn apply_command(&mut self, command: WindowCommand) -> Result<(), PlatformError>
Auto Trait Implementations§
impl Forget for HeadlessPlatform
impl Freeze for HeadlessPlatform
impl Move for HeadlessPlatform
impl RefUnwindSafe for HeadlessPlatform
impl Send for HeadlessPlatform
impl Sync for HeadlessPlatform
impl Unpin for HeadlessPlatform
impl UnsafeUnpin for HeadlessPlatform
impl UnwindSafe for HeadlessPlatform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more