pub struct Application(/* private fields */);Expand description
A reference to a GPUI application, typically constructed in the main function of your app.
You won’t interact with this type much outside of initial configuration and startup.
Implementations§
Source§impl Application
Represents an application before it is fully launched. Once your app is
configured, you’ll start the app with App::run.
impl Application
Represents an application before it is fully launched. Once your app is
configured, you’ll start the app with App::run.
Sourcepub fn with_platform(platform: Rc<dyn Platform>) -> Application
pub fn with_platform(platform: Rc<dyn Platform>) -> Application
Builds an app with a caller-provided platform implementation.
Sourcepub fn new_inaccessible(platform: Rc<dyn Platform>) -> Application
pub fn new_inaccessible(platform: Rc<dyn Platform>) -> Application
Builds an app with accessibility (AccessKit) integration forcibly disabled.
In this mode, accessibility APIs (e.g.
div().role()) silently
no-op.
See the accessibility guide for an overview of the features this disables.
Sourcepub fn with_assets(self, asset_source: impl AssetSource) -> Application
pub fn with_assets(self, asset_source: impl AssetSource) -> Application
Assigns the source of assets for the application.
Sourcepub fn with_restart_arguments(self, arguments: Vec<OsString>) -> Application
pub fn with_restart_arguments(self, arguments: Vec<OsString>) -> Application
Configures arguments to pass when restarting the application.
Sourcepub fn with_http_client(self, http_client: Arc<dyn HttpClient>) -> Application
pub fn with_http_client(self, http_client: Arc<dyn HttpClient>) -> Application
Sets the HTTP client for the application.
Sourcepub fn with_quit_mode(self, mode: QuitMode) -> Application
pub fn with_quit_mode(self, mode: QuitMode) -> Application
Configures when the application should automatically quit.
By default, QuitMode::Default is used.
Sourcepub fn run<F>(self, on_finish_launching: F)
pub fn run<F>(self, on_finish_launching: F)
Start the application. The provided callback will be called once the app is fully launched.
Sourcepub fn run_embedded<F>(self, on_finish_launching: F) -> ApplicationHandle
pub fn run_embedded<F>(self, on_finish_launching: F) -> ApplicationHandle
Start the application for an embedder that drives the run loop itself.
On ordinary platforms Platform::run blocks for the lifetime of the app, and the
app state is kept alive by Application::run’s stack frame. Embedded platforms —
where the run loop belongs to someone else, e.g. GPUI compiled into a Wasm guest,
or a GPUI view hosted inside a foreign native application — implement
Platform::run to invoke the launch callback and return immediately. This method
supports that shape: it returns an ApplicationHandle that keeps the app alive
and lets the embedder re-enter it whenever the external run loop yields control.
Sourcepub fn on_open_urls<F>(&self, callback: F) -> &Application
pub fn on_open_urls<F>(&self, callback: F) -> &Application
Register a handler to be invoked when the platform instructs the application to open one or more URLs.
Sourcepub fn on_reopen<F>(&self, callback: F) -> &Application
pub fn on_reopen<F>(&self, callback: F) -> &Application
Invokes a handler when an already-running application is launched. On macOS, this can occur when the application icon is double-clicked or the app is launched via the dock.
Sourcepub fn background_executor(&self) -> BackgroundExecutor
pub fn background_executor(&self) -> BackgroundExecutor
Returns a handle to the BackgroundExecutor associated with this app, which can be used to spawn futures in the background.
Sourcepub fn foreground_executor(&self) -> ForegroundExecutor
pub fn foreground_executor(&self) -> ForegroundExecutor
Returns a handle to the ForegroundExecutor associated with this app, which can be used to spawn futures in the foreground.
Sourcepub fn text_system(&self) -> Arc<TextSystem> ⓘ
pub fn text_system(&self) -> Arc<TextSystem> ⓘ
Returns a reference to the TextSystem associated with this app.
Auto Trait Implementations§
impl !RefUnwindSafe for Application
impl !Send for Application
impl !Sync for Application
impl !UnwindSafe for Application
impl Freeze 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
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> 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