rio_window::platform::web

Trait WindowAttributesExtWebSys

Source
pub trait WindowAttributesExtWebSys {
    // Required methods
    fn with_canvas(self, canvas: Option<HtmlCanvasElement>) -> Self;
    fn with_prevent_default(self, prevent_default: bool) -> Self;
    fn with_focusable(self, focusable: bool) -> Self;
    fn with_append(self, append: bool) -> Self;
}

Required Methods§

Source

fn with_canvas(self, canvas: Option<HtmlCanvasElement>) -> Self

Pass an HtmlCanvasElement to be used for this Window. If None, WindowAttributes::default() will create one.

In any case, the canvas won’t be automatically inserted into the web page.

None by default.

Source

fn with_prevent_default(self, prevent_default: bool) -> Self

Sets whether event.preventDefault() should be called on events on the canvas that have side effects.

See Window::set_prevent_default() for more details.

Enabled by default.

Source

fn with_focusable(self, focusable: bool) -> Self

Whether the canvas should be focusable using the tab key. This is necessary to capture canvas keyboard events.

Enabled by default.

Source

fn with_append(self, append: bool) -> Self

On window creation, append the canvas element to the web page if it isn’t already.

Disabled by default.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§