Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime { /* private fields */ }

Implementations§

Source§

impl Runtime

Source

pub fn new() -> Self

Source

pub fn add_window(&mut self, builder: WindowBuilder) -> Result<WindowId>

Source

pub fn clipboard(&self) -> Clipboard

Shared clipboard handle used by every window in this runtime.

Source

pub fn set_clipboard_backend(&self, backend: impl ClipboardBackend + 'static)

Install a clipboard storage driver (for example an OS-clipboard bridge provided by the platform). Existing windows pick it up immediately.

Source

pub fn remove_window(&mut self, window_id: WindowId) -> Result<()>

Source

pub fn handle_event(&mut self, window_id: WindowId, event: Event) -> Result<()>

Source

pub fn handle_semantics_action( &mut self, window_id: WindowId, target: WidgetId, action: SemanticsActionRequest, ) -> Result<bool>

Invoke an action advertised by a node in the latest semantic snapshot.

The semantic node does not need to be a retained WidgetPod. Virtual and generated nodes are routed to their nearest graph-backed semantic ancestor while SemanticsEvent::target preserves the original node identity for widget-local dispatch. The return value is false when the node is stale, hidden, disabled, does not advertise the action, or no widget handles an action without a built-in runtime fallback.

Source

pub fn tick(&mut self, frame_time: f64)

Source

pub fn drain_ready_events(&mut self) -> Vec<(WindowId, Event)>

Source

pub fn next_wakeup_time(&self, window_id: WindowId) -> Result<Option<f64>>

Source

pub fn wake_async( &mut self, window_id: WindowId, token: AsyncWakeToken, ) -> Result<bool>

Source

pub fn wake_root(&mut self, window_id: WindowId) -> Result<()>

Deliver an external-wake Event::Custom (kind EXTERNAL_WAKE_KIND) to a window’s root widget. Used by the platform to translate a background-thread wake into a UI event, so widgets can drain channels / async results. Routed to the root and its effects (invalidations, wake requests) applied like any other event.

Source

pub fn register_font( &mut self, handle: FontHandle, font: RegisteredFont, ) -> Result<()>

Source

pub fn register_font_bytes( &mut self, data: impl Into<Vec<u8>>, ) -> Result<FontHandle>

Source

pub fn register_image( &mut self, handle: ImageHandle, image: RegisteredImage, ) -> Result<()>

Source

pub fn register_svg_image_with_handle( &mut self, handle: ImageHandle, data: impl AsRef<[u8]>, ) -> Result<()>

Source

pub fn register_rgba_image( &mut self, width: u32, height: u32, data: impl Into<Vec<u8>>, ) -> Result<ImageHandle>

Source

pub fn register_svg_image( &mut self, data: impl AsRef<[u8]>, ) -> Result<ImageHandle>

Source

pub fn register_svg_image_at_size_with_handle( &mut self, handle: ImageHandle, width: u32, height: u32, data: impl AsRef<[u8]>, ) -> Result<()>

Source

pub fn register_svg_image_at_size( &mut self, width: u32, height: u32, data: impl AsRef<[u8]>, ) -> Result<ImageHandle>

Source

pub fn register_embedded_svg_image( &mut self, resource: EmbeddedSvgImageResource, ) -> Result<()>

Source

pub fn register_embedded_svg_images( &mut self, resources: impl IntoIterator<Item = EmbeddedSvgImageResource>, ) -> Result<()>

Source

pub fn font_registry(&self) -> &Arc<FontRegistry>

Source

pub fn image_registry(&self) -> &Arc<ImageRegistry>

Source

pub fn render(&mut self, window_id: WindowId) -> Result<RenderOutput>

Source

pub fn semantics(&self, window_id: WindowId) -> Result<&[SemanticsNode]>

Source

pub fn window_title(&self, window_id: WindowId) -> Result<&str>

Source

pub fn window_icon(&self, window_id: WindowId) -> Result<Option<&WindowIcon>>

Source

pub fn window_ids(&self) -> Vec<WindowId>

Source

pub fn needs_render(&self, window_id: WindowId) -> Result<bool>

Source

pub fn schedule(&self, window_id: WindowId) -> Result<FrameSchedule>

Source

pub fn focus_state(&self, window_id: WindowId) -> Result<FocusState>

Source

pub fn focused_widget(&self, window_id: WindowId) -> Result<Option<WidgetId>>

Source

pub fn pointer_capture_target( &self, window_id: WindowId, pointer_id: u64, ) -> Result<Option<WidgetId>>

Source

pub fn widget_graph(&self, window_id: WindowId) -> Result<WidgetGraphSnapshot>

Trait Implementations§

Source§

impl Default for Runtime

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.