pub struct Rejection {
pub body: Option<Bytes>,
pub headers: Vec<(String, String)>,
pub status: u16,
}Expand description
A filter rejection response.
use praxis_filter::Rejection;
// Simple status-only rejection:
let r = Rejection::status(403);
assert_eq!(r.status, 403);
assert!(r.headers.is_empty());
assert!(r.body.is_none());
// Rich rejection with headers and body:
let r = Rejection::status(429)
.with_header("Retry-After", "60")
.with_body(b"rate limit exceeded".as_slice());
assert_eq!(r.status, 429);
assert_eq!(r.headers.len(), 1);
assert!(r.body.is_some());Fields§
§body: Option<Bytes>Response body.
headers: Vec<(String, String)>Response headers.
status: u16HTTP status code.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Rejection
impl RefUnwindSafe for Rejection
impl Send for Rejection
impl Sync for Rejection
impl Unpin for Rejection
impl UnsafeUnpin for Rejection
impl UnwindSafe for Rejection
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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