pub struct Application { /* private fields */ }Expand description
Implementations§
Source§impl Application
impl Application
Sourcepub fn window(self, window: WindowBuilder) -> Self
pub fn window(self, window: WindowBuilder) -> Self
Add a lower-level window builder.
Sourcepub fn controller(self, controller: impl CommandController + 'static) -> Self
pub fn controller(self, controller: impl CommandController + 'static) -> Self
Attach an application-scoped controller outside the widget tree.
Sourcepub fn url_policy(self, policy: UrlPolicy) -> Self
pub fn url_policy(self, policy: UrlPolicy) -> Self
Decide which URLs EventCtx::open_url hands to the platform, in place
of the default that opens only http, https, and mailto URLs. See
UrlPolicy.
Sourcepub fn on_command<T, F>(self, key: CommandKey<T>, handler: F) -> Self
pub fn on_command<T, F>(self, key: CommandKey<T>, handler: F) -> Self
Subscribe an application-scoped typed command handler.
Sourcepub fn with_feathering_enabled(self, enabled: bool) -> Self
pub fn with_feathering_enabled(self, enabled: bool) -> Self
Enable or disable analytic-edge feathering in the WGPU renderer.
Sourcepub fn with_feather_width(self, feather_width: f32) -> Self
pub fn with_feather_width(self, feather_width: f32) -> Self
Set the analytic-edge feather width in logical pixels.
Sourcepub fn with_external_texture_registry(
self,
registry: WgpuExternalTextureRegistry,
) -> Self
pub fn with_external_texture_registry( self, registry: WgpuExternalTextureRegistry, ) -> Self
Attach an app-owned external texture registry.
Sourcepub fn feathering_enabled(&self) -> bool
pub fn feathering_enabled(&self) -> bool
Return whether renderer feathering is enabled.
Sourcepub fn feather_width(&self) -> f32
pub fn feather_width(&self) -> f32
Return the configured renderer feather width.
Sourcepub fn external_texture_registry(&self) -> Option<&WgpuExternalTextureRegistry>
pub fn external_texture_registry(&self) -> Option<&WgpuExternalTextureRegistry>
Borrow the configured external texture registry, if present.
Sourcepub fn with_window_render_options(self, options: WindowRenderOptions) -> Self
pub fn with_window_render_options(self, options: WindowRenderOptions) -> Self
Set initial render options applied to every window at startup.
Sourcepub fn initial_window_render_options(&self) -> Option<WindowRenderOptions>
pub fn initial_window_render_options(&self) -> Option<WindowRenderOptions>
Return the initial render options, if configured.
Sourcepub fn register_font(
&mut self,
handle: FontHandle,
font: RegisteredFont,
) -> Result<()>
pub fn register_font( &mut self, handle: FontHandle, font: RegisteredFont, ) -> Result<()>
Register a font with an explicit handle.
Sourcepub fn register_font_bytes(
&mut self,
data: impl Into<Vec<u8>>,
) -> Result<FontHandle>
pub fn register_font_bytes( &mut self, data: impl Into<Vec<u8>>, ) -> Result<FontHandle>
Register a TrueType, OpenType, WOFF, or WOFF2 font and allocate a handle. Fails when the data is not such a font.
Sourcepub fn register_image(
&mut self,
handle: ImageHandle,
image: RegisteredImage,
) -> Result<()>
pub fn register_image( &mut self, handle: ImageHandle, image: RegisteredImage, ) -> Result<()>
Register an image with an explicit handle.
Sourcepub fn register_rgba_image(
&mut self,
width: u32,
height: u32,
data: impl Into<Vec<u8>>,
) -> Result<ImageHandle>
pub fn register_rgba_image( &mut self, width: u32, height: u32, data: impl Into<Vec<u8>>, ) -> Result<ImageHandle>
Register RGBA8 pixels and allocate an image handle.
Sourcepub fn register_svg_image(
&mut self,
data: impl AsRef<[u8]>,
) -> Result<ImageHandle>
pub fn register_svg_image( &mut self, data: impl AsRef<[u8]>, ) -> Result<ImageHandle>
Register SVG bytes at their intrinsic size and allocate an image handle.
Sourcepub fn register_svg_image_with_handle(
&mut self,
handle: ImageHandle,
data: impl AsRef<[u8]>,
) -> Result<()>
pub fn register_svg_image_with_handle( &mut self, handle: ImageHandle, data: impl AsRef<[u8]>, ) -> Result<()>
Register SVG bytes at their intrinsic size with an explicit handle.
Sourcepub fn register_svg_image_at_size(
&mut self,
width: u32,
height: u32,
data: impl AsRef<[u8]>,
) -> Result<ImageHandle>
pub fn register_svg_image_at_size( &mut self, width: u32, height: u32, data: impl AsRef<[u8]>, ) -> Result<ImageHandle>
Rasterize SVG bytes at an explicit size and allocate an image handle.
Sourcepub fn register_svg_image_at_size_with_handle(
&mut self,
handle: ImageHandle,
width: u32,
height: u32,
data: impl AsRef<[u8]>,
) -> Result<()>
pub fn register_svg_image_at_size_with_handle( &mut self, handle: ImageHandle, width: u32, height: u32, data: impl AsRef<[u8]>, ) -> Result<()>
Rasterize SVG bytes at an explicit size and handle.
Sourcepub fn register_embedded_svg_image(
&mut self,
resource: EmbeddedSvgImageResource,
) -> Result<()>
pub fn register_embedded_svg_image( &mut self, resource: EmbeddedSvgImageResource, ) -> Result<()>
Register one embedded SVG resource.
Sourcepub fn register_embedded_svg_images(
&mut self,
resources: impl IntoIterator<Item = EmbeddedSvgImageResource>,
) -> Result<()>
pub fn register_embedded_svg_images( &mut self, resources: impl IntoIterator<Item = EmbeddedSvgImageResource>, ) -> Result<()>
Register multiple embedded SVG resources.
Sourcepub fn build(self) -> Result<Runtime>
pub fn build(self) -> Result<Runtime>
Build the retained runtime without starting a platform event loop.
Sourcepub fn run(self) -> Result<()>
pub fn run(self) -> Result<()>
Build and run the application on the default desktop or web platform.
Sourcepub fn run_with_platform(self, platform: DesktopPlatform) -> Result<()>
pub fn run_with_platform(self, platform: DesktopPlatform) -> Result<()>
Build and run the application with a configured desktop platform host.
This is the integration point for optional native-surface libraries. Renderer settings already configured on the application are applied to the supplied platform before the event loop starts.
Sourcepub fn run_with_platform_and_handle(
self,
platform: DesktopPlatform,
on_ready: impl FnOnce(CommandSender),
) -> Result<()>
pub fn run_with_platform_and_handle( self, platform: DesktopPlatform, on_ready: impl FnOnce(CommandSender), ) -> Result<()>
Like run_with_platform but invokes
on_ready with the application’s typed command sender.
Sourcepub fn start_pumped_with(
self,
on_ready: impl FnOnce(CommandSender),
) -> Result<PumpedDesktop>
pub fn start_pumped_with( self, on_ready: impl FnOnce(CommandSender), ) -> Result<PumpedDesktop>
Start the application on the desktop without blocking, invoking
on_ready with the application’s typed command sender. The caller
drives the event loop with PumpedDesktop::pump.
Sourcepub fn run_with(self, on_ready: impl FnOnce(CommandSender)) -> Result<()>
pub fn run_with(self, on_ready: impl FnOnce(CommandSender)) -> Result<()>
Like run but invokes on_ready with a typed,
thread-safe CommandSender once the event loop is created.
Trait Implementations§
Source§impl Default for Application
impl Default for Application
Auto Trait Implementations§
impl !RefUnwindSafe for Application
impl !Send for Application
impl !Sync for Application
impl !UnwindSafe for Application
impl Forget for Application
impl Freeze for Application
impl Move for Application
impl Unpin for Application
impl UnsafeUnpin for Application
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.