Struct salvo_proxy::Proxy
source · #[non_exhaustive]pub struct Proxy<U, C>{
pub upstreams: U,
pub client: C,
pub url_path_getter: UrlPartGetter,
pub url_query_getter: UrlPartGetter,
}Expand description
Handler that can proxy request to other server.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.upstreams: UUpstreams list.
client: CClient for proxy.
url_path_getter: UrlPartGetterUrl path getter.
url_query_getter: UrlPartGetterUrl query getter.
Implementations§
source§impl<U> Proxy<U, HyperClient>
impl<U> Proxy<U, HyperClient>
sourcepub fn default_hyper_client(upstreams: U) -> Self
pub fn default_hyper_client(upstreams: U) -> Self
Create new Proxy which use default hyper util client.
source§impl<U, C> Proxy<U, C>
impl<U, C> Proxy<U, C>
sourcepub fn url_path_getter<G>(self, url_path_getter: G) -> Self
pub fn url_path_getter<G>(self, url_path_getter: G) -> Self
Set url path getter.
sourcepub fn url_query_getter<G>(self, url_query_getter: G) -> Self
pub fn url_query_getter<G>(self, url_query_getter: G) -> Self
Set url query getter.
sourcepub fn upstreams_mut(&mut self) -> &mut U
pub fn upstreams_mut(&mut self) -> &mut U
Get upstreams mutable list.
sourcepub fn client_mut(&mut self) -> &mut C
pub fn client_mut(&mut self) -> &mut C
Get client mutable reference.
Trait Implementations§
source§impl<U, C> Handler for Proxy<U, C>
impl<U, C> Handler for Proxy<U, C>
source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Auto Trait Implementations§
impl<U, C> !RefUnwindSafe for Proxy<U, C>
impl<U, C> Send for Proxy<U, C>
impl<U, C> Sync for Proxy<U, C>
impl<U, C> Unpin for Proxy<U, C>
impl<U, C> !UnwindSafe for Proxy<U, C>
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