pub struct HttpBridge { /* private fields */ }Expand description
The Streamable HTTP half of Bridge, from Bridge::http.
It exists so that HTTP-only settings do not sit on a builder a stdio app also uses: a token is meaningless without a header to carry it.
Implementations§
Source§impl HttpBridge
impl HttpBridge
Sourcepub fn token(self, token: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
Require every request to carry Authorization: Bearer <token> (mirrors
HttpBuilder::token).
Every process on the machine can reach a loopback port, browser pages included; a token is what makes “on this machine” mean “authorized”.
Sourcepub fn bind(self, addr: impl ToSocketAddrs) -> Result<BoundBridge>
pub fn bind(self, addr: impl ToSocketAddrs) -> Result<BoundBridge>
Build the bridge and bind the listener, without installing anything on
the App yet.
Binding is its own step so that BoundBridge::local_addr is readable
before the server runs — pass port 0, let the OS choose, and you still
know what to tell a client. It also puts the one fallible part of setup
here, which leaves BoundBridge::install unable to fail.
§Errors
io::Error: binding a socket is the only thing here
that touches the outside world. Usually the port is already in use.
Auto Trait Implementations§
impl Freeze for HttpBridge
impl RefUnwindSafe for HttpBridge
impl Send for HttpBridge
impl Sync for HttpBridge
impl Unpin for HttpBridge
impl UnsafeUnpin for HttpBridge
impl UnwindSafe for HttpBridge
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