pub struct StandardWebhook<T>(pub T);Expand description
An extractor that verifies a webhook request and extracts the inner payload.
StandardWebhook<T> wraps another extractor T and ensures that the webhook
signature is valid before proceeding with the extraction of T. This provides
a way to safely handle webhook payloads in Axum handlers.
The inner extractor T can be any type that implements FromRequest,
such as [Json], [Form], or [Query].
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone> Clone for StandardWebhook<T>
impl<T: Clone> Clone for StandardWebhook<T>
Source§fn clone(&self) -> StandardWebhook<T>
fn clone(&self) -> StandardWebhook<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for StandardWebhook<T>
impl<T: Debug> Debug for StandardWebhook<T>
Source§impl<T: Default> Default for StandardWebhook<T>
impl<T: Default> Default for StandardWebhook<T>
Source§fn default() -> StandardWebhook<T>
fn default() -> StandardWebhook<T>
Returns the “default value” for a type. Read more
Source§impl<S, T> FromRequest<S> for StandardWebhook<T>
impl<S, T> FromRequest<S> for StandardWebhook<T>
Source§async fn from_request(
req: Request<Body>,
state: &S,
) -> Result<Self, Self::Rejection>
async fn from_request( req: Request<Body>, state: &S, ) -> Result<Self, Self::Rejection>
Extracts a StandardWebhook<T> from the request.
This method:
- Buffers the request body
- Verifies the webhook signature
- Extracts the inner type
Tfrom the request
§Errors
Returns an error if:
- The request body could not be buffered
- The webhook signature is invalid
- The inner extractor
Tfails
Source§type Rejection = StandardWebhookRejection<<T as FromRequest<S>>::Rejection>
type Rejection = StandardWebhookRejection<<T as FromRequest<S>>::Rejection>
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
impl<T: Copy> Copy for StandardWebhook<T>
Auto Trait Implementations§
impl<T> Freeze for StandardWebhook<T>where
T: Freeze,
impl<T> RefUnwindSafe for StandardWebhook<T>where
T: RefUnwindSafe,
impl<T> Send for StandardWebhook<T>where
T: Send,
impl<T> Sync for StandardWebhook<T>where
T: Sync,
impl<T> Unpin for StandardWebhook<T>where
T: Unpin,
impl<T> UnwindSafe for StandardWebhook<T>where
T: UnwindSafe,
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