pub struct Engine { /* private fields */ }Expand description
Actix-Web compatible wrapper on Engine
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Engine instance.
See mod_rewrite::Engine for more details.
Sourcepub fn max_iterations(self, iterations: usize) -> Self
pub fn max_iterations(self, iterations: usize) -> Self
Configure max number of loops over entire ruleset during rewrite before error.
See mod_rewrite::Engine::max_iterations
for more details.
Sourcepub fn server_context(self, ctx: ServerCtx) -> Self
pub fn server_context(self, ctx: ServerCtx) -> Self
Pass a configured ServerCtx instance
to the engine to use when running Engine::rewrite
Sourcepub fn add_rules(&mut self, rules: &str) -> Result<&mut Self, Error>
pub fn add_rules(&mut self, rules: &str) -> Result<&mut Self, Error>
Parses additonal rewrite expressions to append to the engine.
See mod_rewrite::Engine::add_rules
for more details.
Sourcepub fn rewrite(&self, req: &HttpRequest) -> Result<Rewrite, Error>
pub fn rewrite(&self, req: &HttpRequest) -> Result<Rewrite, Error>
Evaluates the given HttpRequest against
the engine rules and returns a Rewrite response.
Sourcepub fn middleware(self) -> Middleware
pub fn middleware(self) -> Middleware
Converts Engine Instance into Actix-Web Middleware
§Examples
use actix_web::App;
use actix_rewrite::Engine;
let mut engine = Engine::new();
engine.add_rules("RewriteEngine On\n").expect("Failed to add rules");
let app = App::new()
.wrap(engine.middleware());Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnwindSafe for Engine
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