pub struct WebPlatform { /* private fields */ }Expand description
Web platform backend for uzor
This struct handles all browser integration including canvas management, event handling, clipboard operations, and system integration.
Implementations§
Source§impl WebPlatform
impl WebPlatform
Sourcepub fn new(canvas_id: &str) -> Result<Self, String>
pub fn new(canvas_id: &str) -> Result<Self, String>
Create a new WebPlatform from a canvas element ID
§Errors
Returns an error if:
- No window object is available
- No document object is available
- Canvas element with the given ID is not found
- Canvas element is not an HTMLCanvasElement
Sourcepub fn canvas(&self) -> HtmlCanvasElement
pub fn canvas(&self) -> HtmlCanvasElement
Get the underlying canvas element
Trait Implementations§
Source§impl Clone for WebPlatform
impl Clone for WebPlatform
Source§fn clone(&self) -> WebPlatform
fn clone(&self) -> WebPlatform
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl PlatformBackend for WebPlatform
impl PlatformBackend for WebPlatform
Source§fn create_window(
&mut self,
config: WindowConfig,
) -> Result<WindowId, PlatformError>
fn create_window( &mut self, config: WindowConfig, ) -> Result<WindowId, PlatformError>
Create a new window
Source§fn close_window(&mut self, _window_id: WindowId) -> Result<(), PlatformError>
fn close_window(&mut self, _window_id: WindowId) -> Result<(), PlatformError>
Close an existing window
Source§fn primary_window(&self) -> Option<WindowId>
fn primary_window(&self) -> Option<WindowId>
Get primary window ID
Source§fn poll_events(&mut self) -> Vec<PlatformEvent>
fn poll_events(&mut self) -> Vec<PlatformEvent>
Poll for platform events
Source§fn request_redraw(&self, _id: WindowId)
fn request_redraw(&self, _id: WindowId)
Request a redraw of a window
Source§impl SystemIntegration for WebPlatform
impl SystemIntegration for WebPlatform
fn get_clipboard(&self) -> Option<String>
fn set_clipboard(&self, _text: &str)
fn get_system_theme(&self) -> Option<SystemTheme>
impl Send for WebPlatform
impl Sync for WebPlatform
Auto Trait Implementations§
impl Freeze for WebPlatform
impl !RefUnwindSafe for WebPlatform
impl Unpin for WebPlatform
impl UnsafeUnpin for WebPlatform
impl !UnwindSafe for WebPlatform
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