pub struct Builder<F, Args, P1, P1Args> { /* private fields */ }Expand description
Permission builder, combines route, handler and permission check, so you can write something more fluent like:
use actix_web::web;
use actix_web::HttpRequest;
use actix_permissions::builder::Builder;
async fn permission_check(_req: HttpRequest) -> actix_web::Result<bool>{
Ok(true)
}
async fn index() -> actix_web::Result<String> {
Ok("".to_string())
}
Builder::default().check(web::get()).validate(permission_check).to(index);Implementations§
Source§impl<F, Args, P1, P1Args> Builder<F, Args, P1, P1Args>where
F: Handler<Args>,
Args: FromRequest + 'static,
P1: Permission<P1Args>,
P1Args: FromRequest + 'static,
F::Output: Responder,
impl<F, Args, P1, P1Args> Builder<F, Args, P1, P1Args>where
F: Handler<Args>,
Args: FromRequest + 'static,
P1: Permission<P1Args>,
P1Args: FromRequest + 'static,
F::Output: Responder,
Sourcepub fn with_deny_handler(
&mut self,
handler: fn(HttpRequest) -> HttpResponse,
) -> Self
pub fn with_deny_handler( &mut self, handler: fn(HttpRequest) -> HttpResponse, ) -> Self
Returns new builder with custom deny
Trait Implementations§
Auto Trait Implementations§
impl<F, Args, P1, P1Args> Freeze for Builder<F, Args, P1, P1Args>
impl<F, Args, P1, P1Args> !RefUnwindSafe for Builder<F, Args, P1, P1Args>
impl<F, Args, P1, P1Args> !Send for Builder<F, Args, P1, P1Args>
impl<F, Args, P1, P1Args> !Sync for Builder<F, Args, P1, P1Args>
impl<F, Args, P1, P1Args> Unpin for Builder<F, Args, P1, P1Args>
impl<F, Args, P1, P1Args> !UnwindSafe for Builder<F, Args, P1, P1Args>
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