pub struct Window { /* private fields */ }Expand description
Holds the state for a specific window.
Implementations§
Source§impl Window
impl Window
Sourcepub fn observe_window_appearance(
&self,
callback: impl FnMut(&mut Window, &mut App) + 'static,
) -> Subscription
pub fn observe_window_appearance( &self, callback: impl FnMut(&mut Window, &mut App) + 'static, ) -> Subscription
Registers a callback to be invoked when the window appearance changes.
Sourcepub fn replace_root<E>(
&mut self,
cx: &mut App,
build_view: impl FnOnce(&mut Window, &mut Context<'_, E>) -> E,
) -> Entity<E>where
E: 'static + Render,
pub fn replace_root<E>(
&mut self,
cx: &mut App,
build_view: impl FnOnce(&mut Window, &mut Context<'_, E>) -> E,
) -> Entity<E>where
E: 'static + Render,
Replaces the root entity of the window with a new one.
Sourcepub fn root<E>(&self) -> Option<Option<Entity<E>>>where
E: 'static + Render,
pub fn root<E>(&self) -> Option<Option<Entity<E>>>where
E: 'static + Render,
Returns the root entity of the window, if it has one.
Sourcepub fn window_handle(&self) -> AnyWindowHandle
pub fn window_handle(&self) -> AnyWindowHandle
Obtain a handle to the window that belongs to this context.
Sourcepub fn refresh(&mut self)
pub fn refresh(&mut self)
Mark the window as dirty, scheduling it to be redrawn on the next frame.
Sourcepub fn remove_window(&mut self)
pub fn remove_window(&mut self)
Close this window.
Sourcepub fn focused(&self, cx: &App) -> Option<FocusHandle>
pub fn focused(&self, cx: &App) -> Option<FocusHandle>
Obtain the currently focused FocusHandle. If no elements are focused, returns None.
Sourcepub fn focus(&mut self, handle: &FocusHandle)
pub fn focus(&mut self, handle: &FocusHandle)
Move focus to the element associated with the given FocusHandle.
Sourcepub fn disable_focus(&mut self)
pub fn disable_focus(&mut self)
Blur the window and don’t allow anything in it to be focused again.
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Move focus to next tab stop.
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Move focus to previous tab stop.
Sourcepub fn text_system(&self) -> &Arc<WindowTextSystem>
pub fn text_system(&self) -> &Arc<WindowTextSystem>
Accessor for the text system.
Sourcepub fn text_style(&self) -> TextStyle
pub fn text_style(&self) -> TextStyle
The current text style. Which is composed of all the style refinements provided to with_text_style.
Sourcepub fn is_maximized(&self) -> bool
pub fn is_maximized(&self) -> bool
Check if the platform window is maximized.
On some platforms (namely Windows) this is different than the bounds being the size of the display
Sourcepub fn request_decorations(&self, decorations: WindowDecorations)
pub fn request_decorations(&self, decorations: WindowDecorations)
request a certain window decoration (Wayland)
Sourcepub fn start_window_resize(&self, edge: ResizeEdge)
pub fn start_window_resize(&self, edge: ResizeEdge)
Start a window resize operation (Wayland)
Sourcepub fn window_bounds(&self) -> WindowBounds
pub fn window_bounds(&self) -> WindowBounds
Return the WindowBounds to indicate that how a window should be opened
after it has been closed
Sourcepub fn inner_window_bounds(&self) -> WindowBounds
pub fn inner_window_bounds(&self) -> WindowBounds
Return the WindowBounds excluding insets (Wayland and X11)
Sourcepub fn dispatch_action(&mut self, action: Box<dyn Action>, cx: &mut App)
pub fn dispatch_action(&mut self, action: Box<dyn Action>, cx: &mut App)
Dispatch the given action on the currently focused element.
Sourcepub fn defer(
&self,
cx: &mut App,
f: impl FnOnce(&mut Window, &mut App) + 'static,
)
pub fn defer( &self, cx: &mut App, f: impl FnOnce(&mut Window, &mut App) + 'static, )
Schedules the given function to be run at the end of the current effect cycle, allowing entities that are currently on the stack to be returned to the app.
Sourcepub fn observe<T: 'static>(
&mut self,
observed: &Entity<T>,
cx: &mut App,
on_notify: impl FnMut(Entity<T>, &mut Window, &mut App) + 'static,
) -> Subscription
pub fn observe<T: 'static>( &mut self, observed: &Entity<T>, cx: &mut App, on_notify: impl FnMut(Entity<T>, &mut Window, &mut App) + 'static, ) -> Subscription
Subscribe to events emitted by a entity.
The entity to which you’re subscribing must implement the EventEmitter trait.
The callback will be invoked a handle to the emitting entity, the event, and a window context for the current window.
Sourcepub fn subscribe<Emitter, Evt>(
&mut self,
entity: &Entity<Emitter>,
cx: &mut App,
on_event: impl FnMut(Entity<Emitter>, &Evt, &mut Window, &mut App) + 'static,
) -> Subscriptionwhere
Emitter: EventEmitter<Evt>,
Evt: 'static,
pub fn subscribe<Emitter, Evt>(
&mut self,
entity: &Entity<Emitter>,
cx: &mut App,
on_event: impl FnMut(Entity<Emitter>, &Evt, &mut Window, &mut App) + 'static,
) -> Subscriptionwhere
Emitter: EventEmitter<Evt>,
Evt: 'static,
Subscribe to events emitted by a entity.
The entity to which you’re subscribing must implement the EventEmitter trait.
The callback will be invoked a handle to the emitting entity, the event, and a window context for the current window.
Sourcepub fn observe_release<T>(
&self,
entity: &Entity<T>,
cx: &mut App,
on_release: impl FnOnce(&mut T, &mut Window, &mut App) + 'static,
) -> Subscriptionwhere
T: 'static,
pub fn observe_release<T>(
&self,
entity: &Entity<T>,
cx: &mut App,
on_release: impl FnOnce(&mut T, &mut Window, &mut App) + 'static,
) -> Subscriptionwhere
T: 'static,
Register a callback to be invoked when the given Entity is released.
Sourcepub fn to_async(&self, cx: &App) -> AsyncWindowContext
pub fn to_async(&self, cx: &App) -> AsyncWindowContext
Creates an AsyncWindowContext, which has a static lifetime and can be held across
await points in async code.
Sourcepub fn on_next_frame(
&self,
callback: impl FnOnce(&mut Window, &mut App) + 'static,
)
pub fn on_next_frame( &self, callback: impl FnOnce(&mut Window, &mut App) + 'static, )
Schedule the given closure to be run directly after the current frame is rendered.
Sourcepub fn request_animation_frame(&self)
pub fn request_animation_frame(&self)
Schedule a frame to be drawn on the next animation frame.
This is useful for elements that need to animate continuously, such as a video player or an animated GIF. It will cause the window to redraw on the next frame, even if no other changes have occurred.
If called from within a view, it will notify that view on the next frame. Otherwise, it will refresh the entire window.
Sourcepub fn spawn<AsyncFn, R>(&self, cx: &App, f: AsyncFn) -> Task<R> ⓘwhere
R: 'static,
AsyncFn: AsyncFnOnce(&mut AsyncWindowContext) -> R + 'static,
pub fn spawn<AsyncFn, R>(&self, cx: &App, f: AsyncFn) -> Task<R> ⓘwhere
R: 'static,
AsyncFn: AsyncFnOnce(&mut AsyncWindowContext) -> R + 'static,
Spawn the future returned by the given closure on the application thread pool.
The closure is provided a handle to the current window and an AsyncWindowContext for
use within your future.
Sourcepub fn spawn_with_priority<AsyncFn, R>(
&self,
priority: Priority,
cx: &App,
f: AsyncFn,
) -> Task<R> ⓘwhere
R: 'static,
AsyncFn: AsyncFnOnce(&mut AsyncWindowContext) -> R + 'static,
pub fn spawn_with_priority<AsyncFn, R>(
&self,
priority: Priority,
cx: &App,
f: AsyncFn,
) -> Task<R> ⓘwhere
R: 'static,
AsyncFn: AsyncFnOnce(&mut AsyncWindowContext) -> R + 'static,
Spawn the future returned by the given closure on the application thread
pool, with the given priority. The closure is provided a handle to the
current window and an AsyncWindowContext for use within your future.
Sourcepub fn bounds(&self) -> Bounds<Pixels>
pub fn bounds(&self) -> Bounds<Pixels>
Returns the bounds of the current window in the global coordinate space, which could span across multiple displays.
Sourcepub fn is_fullscreen(&self) -> bool
pub fn is_fullscreen(&self) -> bool
Returns whether or not the window is currently fullscreen
Sourcepub fn appearance(&self) -> WindowAppearance
pub fn appearance(&self) -> WindowAppearance
Returns the appearance of the current window.
Sourcepub fn viewport_size(&self) -> Size<Pixels>
pub fn viewport_size(&self) -> Size<Pixels>
Returns the size of the drawable area within the window.
Sourcepub fn is_window_active(&self) -> bool
pub fn is_window_active(&self) -> bool
Returns whether this window is focused by the operating system (receiving key events).
Sourcepub fn is_window_hovered(&self) -> bool
pub fn is_window_hovered(&self) -> bool
Returns whether this window is considered to be the window
that currently owns the mouse cursor.
On mac, this is equivalent to is_window_active.
Sourcepub fn zoom_window(&self)
pub fn zoom_window(&self)
Toggle zoom on the window.
Opens the native title bar context menu, useful when implementing client side decorations (Wayland and X11)
Sourcepub fn start_window_move(&self)
pub fn start_window_move(&self)
Handle window movement for Linux and macOS. Tells the compositor to take control of window movement (Wayland and X11)
Events may not be received during a move operation.
Sourcepub fn set_client_inset(&mut self, inset: Pixels)
pub fn set_client_inset(&mut self, inset: Pixels)
When using client side decorations, set this to the width of the invisible decorations (Wayland and X11)
Sourcepub fn client_inset(&self) -> Option<Pixels>
pub fn client_inset(&self) -> Option<Pixels>
Returns the client_inset value by Self::set_client_inset.
Sourcepub fn window_decorations(&self) -> Decorations
pub fn window_decorations(&self) -> Decorations
Returns whether the title bar window controls need to be rendered by the application (Wayland and X11)
Sourcepub fn window_controls(&self) -> WindowControls
pub fn window_controls(&self) -> WindowControls
Returns which window controls are currently visible (Wayland)
Sourcepub fn set_window_title(&mut self, title: &str)
pub fn set_window_title(&mut self, title: &str)
Updates the window’s title at the platform level.
Sourcepub fn set_app_id(&mut self, app_id: &str)
pub fn set_app_id(&mut self, app_id: &str)
Sets the application identifier.
Sourcepub fn set_background_appearance(
&self,
background_appearance: WindowBackgroundAppearance,
)
pub fn set_background_appearance( &self, background_appearance: WindowBackgroundAppearance, )
Sets the window background appearance.
Sourcepub fn set_window_edited(&mut self, edited: bool)
pub fn set_window_edited(&mut self, edited: bool)
Mark the window as dirty at the platform level.
Sourcepub fn display(&self, cx: &App) -> Option<Rc<dyn PlatformDisplay>>
pub fn display(&self, cx: &App) -> Option<Rc<dyn PlatformDisplay>>
Determine the display on which the window is visible.
Sourcepub fn show_character_palette(&self)
pub fn show_character_palette(&self)
Show the platform character palette.
Sourcepub fn scale_factor(&self) -> f32
pub fn scale_factor(&self) -> f32
The scale factor of the display associated with the window. For example, it could return 2.0 for a “retina” display, indicating that each logical pixel should actually be rendered as two pixels on screen.
Sourcepub fn rem_size(&self) -> Pixels
pub fn rem_size(&self) -> Pixels
The size of an em for the base font of the application. Adjusting this value allows the UI to scale, just like zooming a web page.
Sourcepub fn set_rem_size(&mut self, rem_size: impl Into<Pixels>)
pub fn set_rem_size(&mut self, rem_size: impl Into<Pixels>)
Sets the size of an em for the base font of the application. Adjusting this value allows the UI to scale, just like zooming a web page.
Sourcepub fn with_global_id<R>(
&mut self,
element_id: ElementId,
f: impl FnOnce(&GlobalElementId, &mut Self) -> R,
) -> R
pub fn with_global_id<R>( &mut self, element_id: ElementId, f: impl FnOnce(&GlobalElementId, &mut Self) -> R, ) -> R
Acquire a globally unique identifier for the given ElementId. Only valid for the duration of the provided closure.
Sourcepub fn with_rem_size<F, R>(
&mut self,
rem_size: Option<impl Into<Pixels>>,
f: F,
) -> Rwhere
F: FnOnce(&mut Self) -> R,
pub fn with_rem_size<F, R>(
&mut self,
rem_size: Option<impl Into<Pixels>>,
f: F,
) -> Rwhere
F: FnOnce(&mut Self) -> R,
Executes the provided function with the specified rem size.
This method must only be called as part of element drawing.
Sourcepub fn line_height(&self) -> Pixels
pub fn line_height(&self) -> Pixels
The line height associated with the current text style.
Sourcepub fn prevent_default(&mut self)
pub fn prevent_default(&mut self)
Call to prevent the default action of an event. Currently only used to prevent parent elements from becoming focused on mouse down.
Sourcepub fn default_prevented(&self) -> bool
pub fn default_prevented(&self) -> bool
Obtain whether default has been prevented for the event currently being dispatched.
Sourcepub fn is_action_available(&self, action: &dyn Action, cx: &mut App) -> bool
pub fn is_action_available(&self, action: &dyn Action, cx: &mut App) -> bool
Determine whether the given action is available along the dispatch path to the currently focused element.
Sourcepub fn mouse_position(&self) -> Point<Pixels>
pub fn mouse_position(&self) -> Point<Pixels>
The position of the mouse relative to the window.
Sourcepub fn last_input_was_keyboard(&self) -> bool
pub fn last_input_was_keyboard(&self) -> bool
Returns true if the last input event was keyboard-based (key press, tab navigation, etc.) This is used for focus-visible styling to show focus indicators only for keyboard navigation.
Sourcepub fn draw(&mut self, cx: &mut App) -> ArenaClearNeeded
pub fn draw(&mut self, cx: &mut App) -> ArenaClearNeeded
Produces a new frame and assigns it to rendered_frame. To actually show
the contents of the new [Scene], use Self::present.
Sourcepub fn with_text_style<F, R>(
&mut self,
style: Option<TextStyleRefinement>,
f: F,
) -> Rwhere
F: FnOnce(&mut Self) -> R,
pub fn with_text_style<F, R>(
&mut self,
style: Option<TextStyleRefinement>,
f: F,
) -> Rwhere
F: FnOnce(&mut Self) -> R,
Push a text style onto the stack, and call a function with that style active.
Use Window::text_style to get the current, combined text style. This method
should only be called as part of element drawing.
Sourcepub fn set_cursor_style(&mut self, style: CursorStyle, hitbox: &Hitbox)
pub fn set_cursor_style(&mut self, style: CursorStyle, hitbox: &Hitbox)
Updates the cursor style at the platform level. This method should only be called during the paint phase of element drawing.
Sourcepub fn set_window_cursor_style(&mut self, style: CursorStyle)
pub fn set_window_cursor_style(&mut self, style: CursorStyle)
Updates the cursor style for the entire window at the platform level. A cursor
style using this method will have precedence over any cursor style set using
set_cursor_style. This method should only be called during the paint
phase of element drawing.
Sourcepub fn set_tooltip(&mut self, tooltip: AnyTooltip) -> TooltipId
pub fn set_tooltip(&mut self, tooltip: AnyTooltip) -> TooltipId
Sets a tooltip to be rendered for the upcoming frame. This method should only be called during the paint phase of element drawing.
Sourcepub fn with_content_mask<R>(
&mut self,
mask: Option<ContentMask<Pixels>>,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn with_content_mask<R>( &mut self, mask: Option<ContentMask<Pixels>>, f: impl FnOnce(&mut Self) -> R, ) -> R
Invoke the given function with the given content mask after intersecting it with the current mask. This method should only be called during element drawing.
Sourcepub fn with_element_offset<R>(
&mut self,
offset: Point<Pixels>,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn with_element_offset<R>( &mut self, offset: Point<Pixels>, f: impl FnOnce(&mut Self) -> R, ) -> R
Updates the global element offset relative to the current offset. This is used to implement scrolling. This method should only be called during the prepaint phase of element drawing.
Sourcepub fn with_absolute_element_offset<R>(
&mut self,
offset: Point<Pixels>,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn with_absolute_element_offset<R>( &mut self, offset: Point<Pixels>, f: impl FnOnce(&mut Self) -> R, ) -> R
Updates the global element offset based on the given offset. This is used to implement drag handles and other manual painting of elements. This method should only be called during the prepaint phase of element drawing.
Sourcepub fn transact<T, U>(
&mut self,
f: impl FnOnce(&mut Self) -> Result<T, U>,
) -> Result<T, U>
pub fn transact<T, U>( &mut self, f: impl FnOnce(&mut Self) -> Result<T, U>, ) -> Result<T, U>
Perform prepaint on child elements in a “retryable” manner, so that any side effects
of prepaints can be discarded before prepainting again. This is used to support autoscroll
where we need to prepaint children to detect the autoscroll bounds, then adjust the
element offset and prepaint again. See crate::List for an example. This method should only be
called during the prepaint phase of element drawing.
Sourcepub fn request_autoscroll(&mut self, bounds: Bounds<Pixels>)
pub fn request_autoscroll(&mut self, bounds: Bounds<Pixels>)
When you call this method during Element::prepaint, containing elements will attempt to
scroll to cause the specified bounds to become visible. When they decide to autoscroll, they will call
Element::prepaint again with a new set of bounds. See crate::List for an example of an element
that supports this method being called on the elements it contains. This method should only be
called during the prepaint phase of element drawing.
Sourcepub fn take_autoscroll(&mut self) -> Option<Bounds<Pixels>>
pub fn take_autoscroll(&mut self) -> Option<Bounds<Pixels>>
This method can be called from a containing element such as crate::List to support the autoscroll behavior
described in Self::request_autoscroll.
Sourcepub fn use_asset<A: Asset>(
&mut self,
source: &A::Source,
cx: &mut App,
) -> Option<A::Output>
pub fn use_asset<A: Asset>( &mut self, source: &A::Source, cx: &mut App, ) -> Option<A::Output>
Asynchronously load an asset, if the asset hasn’t finished loading this will return None. Your view will be re-drawn once the asset has finished loading.
Note that the multiple calls to this method will only result in one Asset::load call at a
time.
Sourcepub fn get_asset<A: Asset>(
&mut self,
source: &A::Source,
cx: &mut App,
) -> Option<A::Output>
pub fn get_asset<A: Asset>( &mut self, source: &A::Source, cx: &mut App, ) -> Option<A::Output>
Asynchronously load an asset, if the asset hasn’t finished loading or doesn’t exist this will return None. Your view will not be re-drawn once the asset has finished loading.
Note that the multiple calls to this method will only result in one Asset::load call at a
time.
Sourcepub fn element_offset(&self) -> Point<Pixels>
pub fn element_offset(&self) -> Point<Pixels>
Obtain the current element offset. This method should only be called during the prepaint phase of element drawing.
Sourcepub fn content_mask(&self) -> ContentMask<Pixels>
pub fn content_mask(&self) -> ContentMask<Pixels>
Obtain the current content mask. This method should only be called during element drawing.
Sourcepub fn with_element_namespace<R>(
&mut self,
element_id: impl Into<ElementId>,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn with_element_namespace<R>( &mut self, element_id: impl Into<ElementId>, f: impl FnOnce(&mut Self) -> R, ) -> R
Provide elements in the called function with a new namespace in which their identifiers must be unique. This can be used within a custom element to distinguish multiple sets of child elements.
Sourcepub fn use_keyed_state<S: 'static>(
&mut self,
key: impl Into<ElementId>,
cx: &mut App,
init: impl FnOnce(&mut Self, &mut Context<'_, S>) -> S,
) -> Entity<S>
pub fn use_keyed_state<S: 'static>( &mut self, key: impl Into<ElementId>, cx: &mut App, init: impl FnOnce(&mut Self, &mut Context<'_, S>) -> S, ) -> Entity<S>
Use a piece of state that exists as long this element is being rendered in consecutive frames.
Sourcepub fn with_id<R>(
&mut self,
id: impl Into<ElementId>,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn with_id<R>( &mut self, id: impl Into<ElementId>, f: impl FnOnce(&mut Self) -> R, ) -> R
Immediately push an element ID onto the stack. Useful for simplifying IDs in lists
Sourcepub fn use_state<S: 'static>(
&mut self,
cx: &mut App,
init: impl FnOnce(&mut Self, &mut Context<'_, S>) -> S,
) -> Entity<S>
pub fn use_state<S: 'static>( &mut self, cx: &mut App, init: impl FnOnce(&mut Self, &mut Context<'_, S>) -> S, ) -> Entity<S>
Use a piece of state that exists as long this element is being rendered in consecutive frames, without needing to specify a key
NOTE: This method uses the location of the caller to generate an ID for this state.
If this is not sufficient to identify your state (e.g. you’re rendering a list item),
you can provide a custom ElementID using the use_keyed_state method.
Sourcepub fn with_element_state<S, R>(
&mut self,
global_id: &GlobalElementId,
f: impl FnOnce(Option<S>, &mut Self) -> (R, S),
) -> Rwhere
S: 'static,
pub fn with_element_state<S, R>(
&mut self,
global_id: &GlobalElementId,
f: impl FnOnce(Option<S>, &mut Self) -> (R, S),
) -> Rwhere
S: 'static,
Updates or initializes state for an element with the given id that lives across multiple frames. If an element with this ID existed in the rendered frame, its state will be passed to the given closure. The state returned by the closure will be stored so it can be referenced when drawing the next frame. This method should only be called as part of element drawing.
Sourcepub fn with_optional_element_state<S, R>(
&mut self,
global_id: Option<&GlobalElementId>,
f: impl FnOnce(Option<Option<S>>, &mut Self) -> (R, Option<S>),
) -> Rwhere
S: 'static,
pub fn with_optional_element_state<S, R>(
&mut self,
global_id: Option<&GlobalElementId>,
f: impl FnOnce(Option<Option<S>>, &mut Self) -> (R, Option<S>),
) -> Rwhere
S: 'static,
A variant of with_element_state that allows the element’s id to be optional. This is a convenience
method for elements where the element id may or may not be assigned. Prefer using with_element_state
when the element is guaranteed to have an id.
The first option means ‘no ID provided’ The second option means ‘not yet initialized’
Sourcepub fn with_tab_group<R>(
&mut self,
index: Option<isize>,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn with_tab_group<R>( &mut self, index: Option<isize>, f: impl FnOnce(&mut Self) -> R, ) -> R
Executes the given closure within the context of a tab group.
Sourcepub fn defer_draw(
&mut self,
element: AnyElement,
absolute_offset: Point<Pixels>,
priority: usize,
)
pub fn defer_draw( &mut self, element: AnyElement, absolute_offset: Point<Pixels>, priority: usize, )
Defers the drawing of the given element, scheduling it to be painted on top of the currently-drawn tree
at a later time. The priority parameter determines the drawing order relative to other deferred elements,
with higher values being drawn on top.
This method should only be called as part of the prepaint phase of element drawing.
Sourcepub fn paint_layer<R>(
&mut self,
bounds: Bounds<Pixels>,
f: impl FnOnce(&mut Self) -> R,
) -> R
pub fn paint_layer<R>( &mut self, bounds: Bounds<Pixels>, f: impl FnOnce(&mut Self) -> R, ) -> R
Creates a new painting layer for the specified bounds. A “layer” is a batch of geometry that are non-overlapping and have the same draw order. This is typically used for performance reasons.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_shadows(
&mut self,
bounds: Bounds<Pixels>,
corner_radii: Corners<Pixels>,
shadows: &[BoxShadow],
)
pub fn paint_shadows( &mut self, bounds: Bounds<Pixels>, corner_radii: Corners<Pixels>, shadows: &[BoxShadow], )
Paint one or more drop shadows into the scene for the next frame at the current z-index.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_quad(&mut self, quad: PaintQuad)
pub fn paint_quad(&mut self, quad: PaintQuad)
Paint one or more quads into the scene for the next frame at the current stacking context.
Quads are colored rectangular regions with an optional background, border, and corner radius.
see fill, outline, and quad to construct this type.
This method should only be called as part of the paint phase of element drawing.
Note that the quad.corner_radii are allowed to exceed the bounds, creating sharp corners
where the circular arcs meet. This will not display well when combined with dashed borders.
Use Corners::clamp_radii_for_quad_size if the radii should fit within the bounds.
Sourcepub fn paint_path(&mut self, path: Path<Pixels>, color: impl Into<Background>)
pub fn paint_path(&mut self, path: Path<Pixels>, color: impl Into<Background>)
Paint the given Path into the scene for the next frame at the current z-index.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_underline(
&mut self,
origin: Point<Pixels>,
width: Pixels,
style: &UnderlineStyle,
)
pub fn paint_underline( &mut self, origin: Point<Pixels>, width: Pixels, style: &UnderlineStyle, )
Paint an underline into the scene for the next frame at the current z-index.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_strikethrough(
&mut self,
origin: Point<Pixels>,
width: Pixels,
style: &StrikethroughStyle,
)
pub fn paint_strikethrough( &mut self, origin: Point<Pixels>, width: Pixels, style: &StrikethroughStyle, )
Paint a strikethrough into the scene for the next frame at the current z-index.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_glyph(
&mut self,
origin: Point<Pixels>,
font_id: FontId,
glyph_id: GlyphId,
font_size: Pixels,
color: Hsla,
) -> Result<()>
pub fn paint_glyph( &mut self, origin: Point<Pixels>, font_id: FontId, glyph_id: GlyphId, font_size: Pixels, color: Hsla, ) -> Result<()>
Paints a monochrome (non-emoji) glyph into the scene for the next frame at the current z-index.
The y component of the origin is the baseline of the glyph.
You should generally prefer to use the ShapedLine::paint or
WrappedLine::paint methods in the TextSystem.
This method is only useful if you need to paint a single glyph that has already been shaped.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_emoji(
&mut self,
origin: Point<Pixels>,
font_id: FontId,
glyph_id: GlyphId,
font_size: Pixels,
) -> Result<()>
pub fn paint_emoji( &mut self, origin: Point<Pixels>, font_id: FontId, glyph_id: GlyphId, font_size: Pixels, ) -> Result<()>
Paints an emoji glyph into the scene for the next frame at the current z-index.
The y component of the origin is the baseline of the glyph.
You should generally prefer to use the ShapedLine::paint or
WrappedLine::paint methods in the TextSystem.
This method is only useful if you need to paint a single emoji that has already been shaped.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_svg(
&mut self,
bounds: Bounds<Pixels>,
path: SharedString,
data: Option<&[u8]>,
transformation: TransformationMatrix,
color: Hsla,
cx: &App,
) -> Result<()>
pub fn paint_svg( &mut self, bounds: Bounds<Pixels>, path: SharedString, data: Option<&[u8]>, transformation: TransformationMatrix, color: Hsla, cx: &App, ) -> Result<()>
Paint a monochrome SVG into the scene for the next frame at the current stacking context.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn paint_image(
&mut self,
bounds: Bounds<Pixels>,
corner_radii: Corners<Pixels>,
data: Arc<RenderImage>,
frame_index: usize,
grayscale: bool,
) -> Result<()>
pub fn paint_image( &mut self, bounds: Bounds<Pixels>, corner_radii: Corners<Pixels>, data: Arc<RenderImage>, frame_index: usize, grayscale: bool, ) -> Result<()>
Paint an image into the scene for the next frame at the current z-index. This method will panic if the frame_index is not valid
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn drop_image(&mut self, data: Arc<RenderImage>) -> Result<()>
pub fn drop_image(&mut self, data: Arc<RenderImage>) -> Result<()>
Removes an image from the sprite atlas.
Sourcepub fn request_layout(
&mut self,
style: Style,
children: impl IntoIterator<Item = LayoutId>,
cx: &mut App,
) -> LayoutId
pub fn request_layout( &mut self, style: Style, children: impl IntoIterator<Item = LayoutId>, cx: &mut App, ) -> LayoutId
Add a node to the layout tree for the current frame. Takes the Style of the element for which
layout is being requested, along with the layout ids of any children. This method is called during
calls to the Element::request_layout trait method and enables any element to participate in layout.
This method should only be called as part of the request_layout or prepaint phase of element drawing.
Sourcepub fn request_measured_layout<F>(
&mut self,
style: Style,
measure: F,
) -> LayoutId
pub fn request_measured_layout<F>( &mut self, style: Style, measure: F, ) -> LayoutId
Add a node to the layout tree for the current frame. Instead of taking a Style and children,
this variant takes a function that is invoked during layout so you can use arbitrary logic to
determine the element’s size. One place this is used internally is when measuring text.
The given closure is invoked at layout time with the known dimensions and available space and
returns a Size.
This method should only be called as part of the request_layout or prepaint phase of element drawing.
Sourcepub fn compute_layout(
&mut self,
layout_id: LayoutId,
available_space: Size<AvailableSpace>,
cx: &mut App,
)
pub fn compute_layout( &mut self, layout_id: LayoutId, available_space: Size<AvailableSpace>, cx: &mut App, )
Compute the layout for the given id within the given available space. This method is called for its side effect, typically by the framework prior to painting. After calling it, you can request the bounds of the given layout node id or any descendant.
This method should only be called as part of the prepaint phase of element drawing.
Sourcepub fn layout_bounds(&mut self, layout_id: LayoutId) -> Bounds<Pixels>
pub fn layout_bounds(&mut self, layout_id: LayoutId) -> Bounds<Pixels>
Obtain the bounds computed for the given LayoutId relative to the window. This method will usually be invoked by
GPUI itself automatically in order to pass your element its Bounds automatically.
This method should only be called as part of element drawing.
Sourcepub fn insert_hitbox(
&mut self,
bounds: Bounds<Pixels>,
behavior: HitboxBehavior,
) -> Hitbox
pub fn insert_hitbox( &mut self, bounds: Bounds<Pixels>, behavior: HitboxBehavior, ) -> Hitbox
This method should be called during prepaint. You can use
the returned Hitbox during paint or in an event handler
to determine whether the inserted hitbox was the topmost.
This method should only be called as part of the prepaint phase of element drawing.
Sourcepub fn insert_window_control_hitbox(
&mut self,
area: WindowControlArea,
hitbox: Hitbox,
)
pub fn insert_window_control_hitbox( &mut self, area: WindowControlArea, hitbox: Hitbox, )
Set a hitbox which will act as a control area of the platform window.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn set_key_context(&mut self, context: KeyContext)
pub fn set_key_context(&mut self, context: KeyContext)
Sets the key context for the current element. This context will be used to translate keybindings into actions.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn set_focus_handle(&mut self, focus_handle: &FocusHandle, _: &App)
pub fn set_focus_handle(&mut self, focus_handle: &FocusHandle, _: &App)
Sets the focus handle for the current element. This handle will be used to manage focus state and keyboard event dispatch for the element.
This method should only be called as part of the prepaint phase of element drawing.
Sourcepub fn set_view_id(&mut self, view_id: EntityId)
pub fn set_view_id(&mut self, view_id: EntityId)
Sets the view id for the current element, which will be used to manage view caching.
This method should only be called as part of element prepaint. We plan on removing this method eventually when we solve some issues that require us to construct editor elements directly instead of always using editors via views.
Sourcepub fn current_view(&self) -> EntityId
pub fn current_view(&self) -> EntityId
Get the entity ID for the currently rendering view
Sourcepub fn with_image_cache<F, R>(
&mut self,
image_cache: Option<AnyImageCache>,
f: F,
) -> Rwhere
F: FnOnce(&mut Self) -> R,
pub fn with_image_cache<F, R>(
&mut self,
image_cache: Option<AnyImageCache>,
f: F,
) -> Rwhere
F: FnOnce(&mut Self) -> R,
Executes the provided function with the specified image cache.
Sourcepub fn handle_input(
&mut self,
focus_handle: &FocusHandle,
input_handler: impl InputHandler,
cx: &App,
)
pub fn handle_input( &mut self, focus_handle: &FocusHandle, input_handler: impl InputHandler, cx: &App, )
Sets an input handler, such as ElementInputHandler, which interfaces with the
platform to receive textual input with proper integration with concerns such
as IME interactions. This handler will be active for the upcoming frame until the following frame is
rendered.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn on_mouse_event<Event: MouseEvent>(
&mut self,
listener: impl FnMut(&Event, DispatchPhase, &mut Window, &mut App) + 'static,
)
pub fn on_mouse_event<Event: MouseEvent>( &mut self, listener: impl FnMut(&Event, DispatchPhase, &mut Window, &mut App) + 'static, )
Register a mouse event listener on the window for the next frame. The type of event is determined by the first parameter of the given listener. When the next frame is rendered the listener will be cleared.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn on_key_event<Event: KeyEvent>(
&mut self,
listener: impl Fn(&Event, DispatchPhase, &mut Window, &mut App) + 'static,
)
pub fn on_key_event<Event: KeyEvent>( &mut self, listener: impl Fn(&Event, DispatchPhase, &mut Window, &mut App) + 'static, )
Register a key event listener on this node for the next frame. The type of event is determined by the first parameter of the given listener. When the next frame is rendered the listener will be cleared.
This is a fairly low-level method, so prefer using event handlers on elements unless you have a specific need to register a listener yourself.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn on_modifiers_changed(
&mut self,
listener: impl Fn(&ModifiersChangedEvent, &mut Window, &mut App) + 'static,
)
pub fn on_modifiers_changed( &mut self, listener: impl Fn(&ModifiersChangedEvent, &mut Window, &mut App) + 'static, )
Register a modifiers changed event listener on the window for the next frame.
This is a fairly low-level method, so prefer using event handlers on elements unless you have a specific need to register a global listener.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn on_focus_in(
&mut self,
handle: &FocusHandle,
cx: &mut App,
listener: impl FnMut(&mut Window, &mut App) + 'static,
) -> Subscription
pub fn on_focus_in( &mut self, handle: &FocusHandle, cx: &mut App, listener: impl FnMut(&mut Window, &mut App) + 'static, ) -> Subscription
Register a listener to be called when the given focus handle or one of its descendants receives focus. This does not fire if the given focus handle - or one of its descendants - was previously focused. Returns a subscription and persists until the subscription is dropped.
Sourcepub fn on_focus_out(
&mut self,
handle: &FocusHandle,
cx: &mut App,
listener: impl FnMut(FocusOutEvent, &mut Window, &mut App) + 'static,
) -> Subscription
pub fn on_focus_out( &mut self, handle: &FocusHandle, cx: &mut App, listener: impl FnMut(FocusOutEvent, &mut Window, &mut App) + 'static, ) -> Subscription
Register a listener to be called when the given focus handle or one of its descendants loses focus. Returns a subscription and persists until the subscription is dropped.
Sourcepub fn dispatch_keystroke(&mut self, keystroke: Keystroke, cx: &mut App) -> bool
pub fn dispatch_keystroke(&mut self, keystroke: Keystroke, cx: &mut App) -> bool
Dispatch a given keystroke as though the user had typed it. You can create a keystroke with Keystroke::parse(“”).
Sourcepub fn keystroke_text_for(&self, action: &dyn Action) -> String
pub fn keystroke_text_for(&self, action: &dyn Action) -> String
Return a key binding string for an action, to display in the UI. Uses the highest precedence binding for the action (last binding added to the keymap).
Sourcepub fn dispatch_event(
&mut self,
event: PlatformInput,
cx: &mut App,
) -> DispatchEventResult
pub fn dispatch_event( &mut self, event: PlatformInput, cx: &mut App, ) -> DispatchEventResult
Dispatch a mouse or keyboard event on the window.
Sourcepub fn has_pending_keystrokes(&self) -> bool
pub fn has_pending_keystrokes(&self) -> bool
Determine whether a potential multi-stroke key binding is in progress on this window.
Sourcepub fn pending_input_keystrokes(&self) -> Option<&[Keystroke]>
pub fn pending_input_keystrokes(&self) -> Option<&[Keystroke]>
Returns the currently pending input keystrokes that might result in a multi-stroke key binding.
Sourcepub fn observe_global<G: Global>(
&mut self,
cx: &mut App,
f: impl Fn(&mut Window, &mut App) + 'static,
) -> Subscription
pub fn observe_global<G: Global>( &mut self, cx: &mut App, f: impl Fn(&mut Window, &mut App) + 'static, ) -> Subscription
Register the given handler to be invoked whenever the global of the given type is updated.
Sourcepub fn activate_window(&self)
pub fn activate_window(&self)
Focus the current window and bring it to the foreground at the platform level.
Sourcepub fn minimize_window(&self)
pub fn minimize_window(&self)
Minimize the current window at the platform level.
Sourcepub fn toggle_fullscreen(&self)
pub fn toggle_fullscreen(&self)
Toggle full screen status on the current window at the platform level.
Sourcepub fn invalidate_character_coordinates(&self)
pub fn invalidate_character_coordinates(&self)
Updates the IME panel position suggestions for languages like japanese, chinese.
Sourcepub fn prompt<T>(
&mut self,
level: PromptLevel,
message: &str,
detail: Option<&str>,
answers: &[T],
cx: &mut App,
) -> Receiver<usize>
pub fn prompt<T>( &mut self, level: PromptLevel, message: &str, detail: Option<&str>, answers: &[T], cx: &mut App, ) -> Receiver<usize>
Present a platform dialog. The provided message will be presented, along with buttons for each answer. When a button is clicked, the returned Receiver will receive the index of the clicked button.
Sourcepub fn context_stack(&self) -> Vec<KeyContext>
pub fn context_stack(&self) -> Vec<KeyContext>
Returns the current context stack.
Sourcepub fn available_actions(&self, cx: &App) -> Vec<Box<dyn Action>>
pub fn available_actions(&self, cx: &App) -> Vec<Box<dyn Action>>
Returns all available actions for the focused element.
Sourcepub fn bindings_for_action(&self, action: &dyn Action) -> Vec<KeyBinding>
pub fn bindings_for_action(&self, action: &dyn Action) -> Vec<KeyBinding>
Returns key bindings that invoke an action on the currently focused element. Bindings are returned in the order they were added. For display, the last binding should take precedence.
Sourcepub fn highest_precedence_binding_for_action(
&self,
action: &dyn Action,
) -> Option<KeyBinding>
pub fn highest_precedence_binding_for_action( &self, action: &dyn Action, ) -> Option<KeyBinding>
Returns the highest precedence key binding that invokes an action on the currently focused
element. This is more efficient than getting the last result of bindings_for_action.
Sourcepub fn bindings_for_action_in_context(
&self,
action: &dyn Action,
context: KeyContext,
) -> Vec<KeyBinding>
pub fn bindings_for_action_in_context( &self, action: &dyn Action, context: KeyContext, ) -> Vec<KeyBinding>
Returns the key bindings for an action in a context.
Sourcepub fn highest_precedence_binding_for_action_in_context(
&self,
action: &dyn Action,
context: KeyContext,
) -> Option<KeyBinding>
pub fn highest_precedence_binding_for_action_in_context( &self, action: &dyn Action, context: KeyContext, ) -> Option<KeyBinding>
Returns the highest precedence key binding for an action in a context. This is more
efficient than getting the last result of bindings_for_action_in_context.
Sourcepub fn bindings_for_action_in(
&self,
action: &dyn Action,
focus_handle: &FocusHandle,
) -> Vec<KeyBinding>
pub fn bindings_for_action_in( &self, action: &dyn Action, focus_handle: &FocusHandle, ) -> Vec<KeyBinding>
Returns any bindings that would invoke an action on the given focus handle if it were focused. Bindings are returned in the order they were added. For display, the last binding should take precedence.
Sourcepub fn highest_precedence_binding_for_action_in(
&self,
action: &dyn Action,
focus_handle: &FocusHandle,
) -> Option<KeyBinding>
pub fn highest_precedence_binding_for_action_in( &self, action: &dyn Action, focus_handle: &FocusHandle, ) -> Option<KeyBinding>
Returns the highest precedence key binding that would invoke an action on the given focus
handle if it were focused. This is more efficient than getting the last result of
bindings_for_action_in.
Sourcepub fn listener_for<T: 'static, E>(
&self,
view: &Entity<T>,
f: impl Fn(&mut T, &E, &mut Window, &mut Context<'_, T>) + 'static,
) -> impl Fn(&E, &mut Window, &mut App) + 'static
pub fn listener_for<T: 'static, E>( &self, view: &Entity<T>, f: impl Fn(&mut T, &E, &mut Window, &mut Context<'_, T>) + 'static, ) -> impl Fn(&E, &mut Window, &mut App) + 'static
Returns a generic event listener that invokes the given listener with the view and context associated with the given view handle.
Sourcepub fn handler_for<E: 'static, Callback: Fn(&mut E, &mut Window, &mut Context<'_, E>) + 'static>(
&self,
entity: &Entity<E>,
f: Callback,
) -> impl Fn(&mut Window, &mut App) + 'static
pub fn handler_for<E: 'static, Callback: Fn(&mut E, &mut Window, &mut Context<'_, E>) + 'static>( &self, entity: &Entity<E>, f: Callback, ) -> impl Fn(&mut Window, &mut App) + 'static
Returns a generic handler that invokes the given handler with the view and context associated with the given view handle.
Sourcepub fn on_window_should_close(
&self,
cx: &App,
f: impl Fn(&mut Window, &mut App) -> bool + 'static,
)
pub fn on_window_should_close( &self, cx: &App, f: impl Fn(&mut Window, &mut App) -> bool + 'static, )
Register a callback that can interrupt the closing of the current window based the returned boolean. If the callback returns false, the window won’t be closed.
Sourcepub fn on_action(
&mut self,
action_type: TypeId,
listener: impl Fn(&dyn Any, DispatchPhase, &mut Window, &mut App) + 'static,
)
pub fn on_action( &mut self, action_type: TypeId, listener: impl Fn(&dyn Any, DispatchPhase, &mut Window, &mut App) + 'static, )
Register an action listener on this node for the next frame. The type of action is determined by the first parameter of the given listener. When the next frame is rendered the listener will be cleared.
This is a fairly low-level method, so prefer using action handlers on elements unless you have a specific need to register a listener yourself.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn on_action_when(
&mut self,
condition: bool,
action_type: TypeId,
listener: impl Fn(&dyn Any, DispatchPhase, &mut Window, &mut App) + 'static,
)
pub fn on_action_when( &mut self, condition: bool, action_type: TypeId, listener: impl Fn(&dyn Any, DispatchPhase, &mut Window, &mut App) + 'static, )
Register a capturing action listener on this node for the next frame if the condition is true. The type of action is determined by the first parameter of the given listener. When the next frame is rendered the listener will be cleared.
This is a fairly low-level method, so prefer using action handlers on elements unless you have a specific need to register a listener yourself.
This method should only be called as part of the paint phase of element drawing.
Sourcepub fn gpu_specs(&self) -> Option<GpuSpecs>
pub fn gpu_specs(&self) -> Option<GpuSpecs>
Read information about the GPU backing this window. Currently returns None on Mac and Windows.
Sourcepub fn titlebar_double_click(&self)
pub fn titlebar_double_click(&self)
Perform titlebar double-click action. This is macOS specific.
Sourcepub fn window_title(&self) -> String
pub fn window_title(&self) -> String
Gets the window’s title at the platform level. This is macOS specific.
Sourcepub fn tabbed_windows(&self) -> Option<Vec<SystemWindowTab>>
pub fn tabbed_windows(&self) -> Option<Vec<SystemWindowTab>>
Returns a list of all tabbed windows and their titles. This is macOS specific.
Sourcepub fn tab_bar_visible(&self) -> bool
pub fn tab_bar_visible(&self) -> bool
Returns the tab bar visibility. This is macOS specific.
Sourcepub fn merge_all_windows(&self)
pub fn merge_all_windows(&self)
Merges all open windows into a single tabbed window. This is macOS specific.
Sourcepub fn move_tab_to_new_window(&self)
pub fn move_tab_to_new_window(&self)
Moves the tab to a new containing window. This is macOS specific.
Sourcepub fn toggle_window_tab_overview(&self)
pub fn toggle_window_tab_overview(&self)
Shows or hides the window tab overview. This is macOS specific.
Sourcepub fn set_tabbing_identifier(&self, tabbing_identifier: Option<String>)
pub fn set_tabbing_identifier(&self, tabbing_identifier: Option<String>)
Sets the tabbing identifier for the window. This is macOS specific.
Sourcepub fn toggle_inspector(&mut self, cx: &mut App)
pub fn toggle_inspector(&mut self, cx: &mut App)
Toggles the inspector mode on this window.
Sourcepub fn is_inspector_picking(&self, _cx: &App) -> bool
pub fn is_inspector_picking(&self, _cx: &App) -> bool
Returns true if the window is in inspector mode.
Sourcepub fn with_inspector_state<T: 'static, R>(
&mut self,
_inspector_id: Option<&InspectorElementId>,
cx: &mut App,
f: impl FnOnce(&mut Option<T>, &mut Self) -> R,
) -> R
pub fn with_inspector_state<T: 'static, R>( &mut self, _inspector_id: Option<&InspectorElementId>, cx: &mut App, f: impl FnOnce(&mut Option<T>, &mut Self) -> R, ) -> R
Executes the provided function with mutable access to an inspector state.
Sourcepub fn insert_inspector_hitbox(
&mut self,
hitbox_id: HitboxId,
inspector_id: Option<&InspectorElementId>,
cx: &App,
)
pub fn insert_inspector_hitbox( &mut self, hitbox_id: HitboxId, inspector_id: Option<&InspectorElementId>, cx: &App, )
Registers a hitbox that can be used for inspector picking mode, allowing users to select and inspect UI elements by clicking on them.
Trait Implementations§
Source§impl HasDisplayHandle for Window
impl HasDisplayHandle for Window
Source§fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError>
Source§impl HasWindowHandle for Window
impl HasWindowHandle for Window
Source§fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError>
Auto Trait Implementations§
impl Freeze for Window
impl !RefUnwindSafe for Window
impl !Send for Window
impl !Sync for Window
impl Unpin for Window
impl !UnwindSafe for Window
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
impl<T> HasRawDisplayHandle for Twhere
T: HasDisplayHandle + ?Sized,
Source§fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
fn raw_display_handle(&self) -> Result<RawDisplayHandle, HandleError>
HasDisplayHandle insteadSource§impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
impl<T> HasRawWindowHandle for Twhere
T: HasWindowHandle + ?Sized,
Source§fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
fn raw_window_handle(&self) -> Result<RawWindowHandle, HandleError>
HasWindowHandle insteadSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more