pub struct ReusedServiceBuilder<C = HttpConnector, B = Incoming> { /* private fields */ }Available on crate features
http1 or http2 only.Expand description
The return type of builder(), builder_http(), builder_https(), builder_nativetls() and builder_rustls().
Implementations§
Source§impl<C, B> Builder<C, B>
impl<C, B> Builder<C, B>
Sourcepub fn build<Pr>(&self, path: Pr) -> ReusedService<Pr, C, B>
pub fn build<Pr>(&self, path: Pr) -> ReusedService<Pr, C, B>
Examples found in repository?
examples/http2-proxy.rs (line 68)
55 pub(super) async fn serve() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
56 let proxy_service_builder = builder(
57 Builder::new(hyper_util::rt::TokioExecutor::new())
58 .http2_only(true)
59 .build_http(),
60 Scheme::HTTP,
61 "127.0.0.1:3000",
62 )?;
63
64 let svc: tower_proxy::ReusedService<
65 tower_proxy::Identity,
66 tower_proxy::client::HttpConnector,
67 axum::body::Body,
68 > = proxy_service_builder.build(tower_proxy::rewrite::Identity {});
69
70 let router = Router::new().fallback_service(svc);
71
72 let listener = tokio::net::TcpListener::bind("127.0.0.1:2000")
73 .await
74 .unwrap();
75
76 axum::serve(listener, router).await?;
77
78 Ok(())
79 }Trait Implementations§
Auto Trait Implementations§
impl<C = HttpConnector, B = Incoming> !Freeze for Builder<C, B>
impl<C = HttpConnector, B = Incoming> !RefUnwindSafe for Builder<C, B>
impl<C, B> Send for Builder<C, B>
impl<C, B> Sync for Builder<C, B>
impl<C, B> Unpin for Builder<C, B>
impl<C, B> UnsafeUnpin for Builder<C, B>
impl<C = HttpConnector, B = Incoming> !UnwindSafe for Builder<C, B>
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
Mutably borrows from an owned value. Read more