Skip to main content

PurviewAppExt

Trait PurviewAppExt 

Source
pub trait PurviewAppExt {
    // Required methods
    fn purview(&self) -> AppHandle<App>;
    fn try_purview(&self) -> Option<AppHandle<App>>;
    fn purview_addr(&self) -> Option<SocketAddr>;
}
Expand description

Extension on gpui’s [App] (and thus any Context<V>, which derefs to it) to reach the bridge’s AppHandle — e.g. cx.purview().open("Detail") to open another projected window from inside a view or handler.

Required Methods§

Source

fn purview(&self) -> AppHandle<App>

The installed bridge’s AppHandle.

§Panics

Panics if no bridge was installed on this App (see Bridge).

Source

fn try_purview(&self) -> Option<AppHandle<App>>

The installed bridge’s AppHandle, or None if none was installed.

Source

fn purview_addr(&self) -> Option<SocketAddr>

The address the MCP server is listening on — the port the OS picked, when the requested one was 0.

None if no bridge was installed, or if it serves over stdio (which has no address). Use it to reach the address from a view or a handler, long after setup — to render it, or to put “copy the connect command” behind a button.

The Option is honest here in a way it would not be at the setup site: an App may carry either transport, so this caller genuinely cannot know. Where the transport is known the address comes without one, from BoundBridge::local_addr.

Implementations on Foreign Types§

Source§

impl PurviewAppExt for App

Implementors§