Skip to main content

DesktopFrame

Struct DesktopFrame 

Source
pub struct DesktopFrame { /* private fields */ }
Expand description

Cross-platform desktop frame owned by a native shell backend.

A frame owns its event registrations and command channel until the backend returns. Use the optional native runner or a custom DesktopFrameBackend; clone individual handles, not the owning frame.

Implementations§

Source§

impl DesktopFrame

Source

pub fn app_id(&self) -> Option<&str>

Borrow the immutable application identity.

Source

pub fn runtime(&self) -> &Arc<DesktopRuntime> ⓘ

Borrow the request dispatcher owned by this frame.

Source

pub fn window(&self) -> &WindowOptions

Borrow the immutable window configuration.

Source

pub fn shell(&self) -> &DesktopShellConfig

Borrow the immutable native shell configuration.

Source

pub fn events(&self) -> &EventRegistry

Borrow the frame’s event registry for a custom backend.

Source

pub fn window_handle(&self) -> &WindowHandle

Borrow the sendable window command handle.

Source

pub fn new(runtime: Arc<DesktopRuntime>, window: WindowOptions) -> Result<Self>

Create a desktop frame with default shell options and deny-all IPC permissions.

§Errors

Returns an error if the IPC schema is invalid or window styling differs from the already-rendered runtime.

Source

pub fn on_event<F>(&self, handler: F) -> Result<(), EventRegistrationError>
where F: Fn(&DesktopEvent) -> EventResponse + Send + Sync + 'static,

Register a non-blocking callback for the frame’s lifetime.

§Errors

Returns an error when registration is closed or its bounded capacity is full.

Source

pub fn subscribe<F>( &self, handler: F, ) -> Result<EventSubscription, EventRegistrationError>
where F: Fn(&DesktopEvent) -> EventResponse + Send + Sync + 'static,

Register a callback until the returned subscription is dropped.

§Errors

Returns an error when registration is closed or its bounded capacity is full.

Source

pub fn with_app_id(self, app_id: impl Into<String>) -> Self

Set the application’s stable identity for native services.

Source

pub fn with_shell(self, shell: DesktopShellConfig) -> Self

Attach shell options to the frame.

Trait Implementations§

Source§

impl Drop for DesktopFrame

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.