pub struct JsonRejectionCodes { /* private fields */ }Expand description
Stable error codes for each JSON extractor rejection class.
Supplying this through HttpOptions::with_json_rejection_codes enables
class-specific statuses and codes. Products still choose route body limits
and the text shown to users.
Implementations§
Source§impl JsonRejectionCodes
impl JsonRejectionCodes
Sourcepub fn new(
body_too_large: impl Into<String>,
content_type: impl Into<String>,
syntax: impl Into<String>,
data_shape: impl Into<String>,
) -> Result<Self, HttpOptionsError>
pub fn new( body_too_large: impl Into<String>, content_type: impl Into<String>, syntax: impl Into<String>, data_shape: impl Into<String>, ) -> Result<Self, HttpOptionsError>
Creates a class-specific code set.
Each code must be a non-empty snake_case identifier.
Sourcepub fn body_too_large(&self) -> &str
pub fn body_too_large(&self) -> &str
Returns the code for a body rejected because it is too large.
Sourcepub fn content_type(&self) -> &str
pub fn content_type(&self) -> &str
Returns the code for a missing or invalid JSON content type.
Sourcepub fn data_shape(&self) -> &str
pub fn data_shape(&self) -> &str
Returns the code for JSON that does not match the target data shape.
Trait Implementations§
Source§impl Clone for JsonRejectionCodes
impl Clone for JsonRejectionCodes
Source§fn clone(&self) -> JsonRejectionCodes
fn clone(&self) -> JsonRejectionCodes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonRejectionCodes
impl Debug for JsonRejectionCodes
Source§impl Default for JsonRejectionCodes
impl Default for JsonRejectionCodes
impl Eq for JsonRejectionCodes
Source§impl PartialEq for JsonRejectionCodes
impl PartialEq for JsonRejectionCodes
impl StructuralPartialEq for JsonRejectionCodes
Auto Trait Implementations§
impl Freeze for JsonRejectionCodes
impl RefUnwindSafe for JsonRejectionCodes
impl Send for JsonRejectionCodes
impl Sync for JsonRejectionCodes
impl Unpin for JsonRejectionCodes
impl UnsafeUnpin for JsonRejectionCodes
impl UnwindSafe for JsonRejectionCodes
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.