pub struct ConfigDrivenApp { /* private fields */ }Expand description
An Application that routes requests based on a parsed ProxyConfig.
Clone is cheap: routes is an Arc<Vec<...>> (pointer copy), and
fallback is App, itself cheap to clone (an Option<Arc<ServerConfig>>).
Implementations§
Source§impl ConfigDrivenApp
impl ConfigDrivenApp
Sourcepub fn with_config(self, config: ServerConfig) -> Self
pub fn with_config(self, config: ServerConfig) -> Self
Pin the fallback App (used for any request none of the
config-driven routes match) to an explicit ServerConfig, instead
of reading RWS_CONFIG_* environment variables per request.
Mirrors App::with_config / crate::state::AppWithState::with_config
— same rationale: safe for parallel tests, and lets multiple
differently-configured proxy instances coexist in one process.
use rust_web_server::proxy_config::build_from_file;
use rust_web_server::server_config::ServerConfig;
let (app, _handles) = build_from_file();
let app = app.with_config(ServerConfig::default());Trait Implementations§
Source§impl Application for ConfigDrivenApp
impl Application for ConfigDrivenApp
Source§impl Clone for ConfigDrivenApp
impl Clone for ConfigDrivenApp
Source§fn clone(&self) -> ConfigDrivenApp
fn clone(&self) -> ConfigDrivenApp
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ConfigDrivenApp
impl !UnwindSafe for ConfigDrivenApp
impl Freeze for ConfigDrivenApp
impl Send for ConfigDrivenApp
impl Sync for ConfigDrivenApp
impl Unpin for ConfigDrivenApp
impl UnsafeUnpin for ConfigDrivenApp
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