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 headless() -> Self
pub fn headless() -> Self
Build an app in headless mode. This prevents opening windows, but makes it possible to run an application in an context like SSH, where GUI applications are not allowed.
Sourcepub fn with_assets(self, asset_source: impl AssetSource) -> Self
pub fn with_assets(self, asset_source: impl AssetSource) -> Self
Assign
Sourcepub fn with_http_client(self, http_client: Arc<dyn HttpClient>) -> Self
pub fn with_http_client(self, http_client: Arc<dyn HttpClient>) -> Self
Sets the HTTP client for the application.
Sourcepub fn with_quit_mode(self, mode: QuitMode) -> Self
pub fn with_quit_mode(self, mode: QuitMode) -> Self
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 on_open_urls<F>(&self, callback: F) -> &Self
pub fn on_open_urls<F>(&self, callback: F) -> &Self
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) -> &Self
pub fn on_reopen<F>(&self, callback: F) -> &Self
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.
Sourcepub fn path_for_auxiliary_executable(&self, name: &str) -> Result<PathBuf>
pub fn path_for_auxiliary_executable(&self, name: &str) -> Result<PathBuf>
Returns the file URL of the executable with the specified name in the application bundle
Auto Trait Implementations§
impl Freeze for Application
impl !RefUnwindSafe for Application
impl !Send for Application
impl !Sync for Application
impl Unpin for Application
impl !UnwindSafe 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