Struct salvo_proxy::Proxy
source · #[non_exhaustive]pub struct Proxy<U> {
pub upstreams: U,
pub client: Client,
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: ClientClient for proxy.
url_path_getter: UrlPartGetterUrl path getter.
url_query_getter: UrlPartGetterUrl query getter.
Implementations§
source§impl<U> Proxy<U>where
U: Upstreams,
U::Error: Into<BoxedError>,
impl<U> Proxy<U>where U: Upstreams, U::Error: Into<BoxedError>,
sourcepub fn with_client(upstreams: U, client: Client) -> Self
pub fn with_client(upstreams: U, client: Client) -> Self
Create new Proxy with upstreams list and Client.
sourcepub fn url_path_getter<G>(self, url_path_getter: G) -> Selfwhere
G: Fn(&Request, &Depot) -> Option<String> + Send + Sync + 'static,
pub fn url_path_getter<G>(self, url_path_getter: G) -> Selfwhere G: Fn(&Request, &Depot) -> Option<String> + Send + Sync + 'static,
Set url path getter.
sourcepub fn url_query_getter<G>(self, url_query_getter: G) -> Selfwhere
G: Fn(&Request, &Depot) -> Option<String> + Send + Sync + 'static,
pub fn url_query_getter<G>(self, url_query_getter: G) -> Selfwhere G: Fn(&Request, &Depot) -> Option<String> + Send + Sync + 'static,
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 Client
pub fn client_mut(&mut self) -> &mut Client
Get client mutable reference.
Trait Implementations§
source§impl<U> Handler for Proxy<U>where
U: Upstreams,
U::Error: Into<BoxedError>,
impl<U> Handler for Proxy<U>where U: Upstreams, U::Error: Into<BoxedError>,
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> !RefUnwindSafe for Proxy<U>
impl<U> Send for Proxy<U>where U: Send,
impl<U> Sync for Proxy<U>where U: Sync,
impl<U> Unpin for Proxy<U>where U: Unpin,
impl<U> !UnwindSafe for Proxy<U>
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