pub struct Bridge { /* private fields */ }Expand description
Builder that installs a purview bridge onto a live gpui [App].
Call it inside Application::run’s |cx: &mut App| closure; installing
returns a purview::AppHandle on which you declare windows and actions
exactly as with the core crate. The channel, drain loop, and server-handle
lifetime are all handled internally (the server stops when the App tears
down).
Pick a transport with http or
install_stdio. The two shapes differ because HTTP
has an address to report and a bind that can fail, and stdio has neither —
the same split the core crate makes.
Implementations§
Source§impl Bridge
impl Bridge
Sourcepub fn instructions_append(self, extra: impl Into<String>) -> Self
pub fn instructions_append(self, extra: impl Into<String>) -> Self
Append to the MCP instructions (mirrors
GuiBridgeBuilder::instructions_append).
Sourcepub fn http(self) -> HttpBridge
pub fn http(self) -> HttpBridge
Switch to the Streamable HTTP builder — the door to a token and to the served address.
let papp = Bridge::new()
.instructions_append("A single-window counter.")
.http()
.bind("127.0.0.1:8931")
.expect("bind the MCP port")
.install(cx);Sourcepub fn install_stdio(self, cx: &mut App) -> AppHandle<App>
pub fn install_stdio(self, cx: &mut App) -> AppHandle<App>
Serve MCP over stdio on a background thread and return the
AppHandle.
One call, unlike the HTTP path: there is no address to hand back, and nothing here that can fail.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bridge
impl RefUnwindSafe for Bridge
impl Send for Bridge
impl Sync for Bridge
impl Unpin for Bridge
impl UnsafeUnpin for Bridge
impl UnwindSafe for Bridge
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().