pub struct OAuth2PasswordRequestFormStrict {
pub form: OAuth2PasswordRequestForm,
}Expand description
Strict variant of OAuth2PasswordRequestForm.
Same as OAuth2PasswordRequestForm, but requires grant_type to be
present and equal to "password". Returns an error if grant_type is
missing or has any other value.
§Example
ⓘ
use fastapi_core::OAuth2PasswordRequestFormStrict;
async fn login(form: OAuth2PasswordRequestFormStrict) -> Response {
// grant_type is guaranteed to be "password"
let username = &form.form.username;
let scopes = form.form.scopes();
// ...
}Fields§
§form: OAuth2PasswordRequestFormThe validated form data. The grant_type is guaranteed to be Some("password").
Implementations§
Source§impl OAuth2PasswordRequestFormStrict
impl OAuth2PasswordRequestFormStrict
Sourcepub fn inner(&self) -> &OAuth2PasswordRequestForm
pub fn inner(&self) -> &OAuth2PasswordRequestForm
Get a reference to the inner form.
Sourcepub fn into_inner(self) -> OAuth2PasswordRequestForm
pub fn into_inner(self) -> OAuth2PasswordRequestForm
Consume self and return the inner form.
Methods from Deref<Target = OAuth2PasswordRequestForm>§
Trait Implementations§
Source§impl Clone for OAuth2PasswordRequestFormStrict
impl Clone for OAuth2PasswordRequestFormStrict
Source§fn clone(&self) -> OAuth2PasswordRequestFormStrict
fn clone(&self) -> OAuth2PasswordRequestFormStrict
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 FromRequest for OAuth2PasswordRequestFormStrict
impl FromRequest for OAuth2PasswordRequestFormStrict
Source§type Error = OAuth2PasswordFormError
type Error = OAuth2PasswordFormError
Error type when extraction fails.
Source§async fn from_request(
ctx: &RequestContext,
req: &mut Request,
) -> Result<Self, Self::Error>
async fn from_request( ctx: &RequestContext, req: &mut Request, ) -> Result<Self, Self::Error>
Extract a value from the request. Read more
Auto Trait Implementations§
impl Freeze for OAuth2PasswordRequestFormStrict
impl RefUnwindSafe for OAuth2PasswordRequestFormStrict
impl Send for OAuth2PasswordRequestFormStrict
impl Sync for OAuth2PasswordRequestFormStrict
impl Unpin for OAuth2PasswordRequestFormStrict
impl UnwindSafe for OAuth2PasswordRequestFormStrict
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).