pub enum ResponsesRedirectionCodes {
Show 43 variants
MultipleChoices,
MovedPermanently,
Found,
SeeOther,
NotModified,
UseProxy,
SwitchProxy,
TemporaryRedirect,
PermanentRedirect,
TooManyRedirects,
RedirectMethod,
Unassigned,
MovedPermanentlyRedirected,
MovedTemporarilyRedirected,
SeeOtherRedirected,
NotModifiedRedirected,
UseProxyRedirected,
UnusedRedirected,
TemporaryRedirectRedirected,
PermanentRedirected,
TooManyRedirectsRedirected,
RedirectMethodRedirected,
UserNameOkPasswordNeeded,
NoNeedAccountForLogin,
SessionKeyNotPresentInHeader,
SessionKeyPresentAndNotDecryptableParsable,
ServerIsUnwillingToProcessTheRequest,
ChallengeResponseAuthenticationOk,
ChallengeResponseAuthenticationFailed,
LengthRequired,
PreconditionFailed,
RequestEntityTooLarge,
UnsupportedMediaType,
RequestedRangeNotSatisfiable,
ExpectationFailed,
ImATeapot,
ErrorAccessingURL,
TriggerNotFound,
AccessDenied,
ConditionFailed,
MandatoryParameterIsNull,
TheParameterDoesNotExist,
DataBLOBShouldNotBeNullForPostMethod,
}Expand description
Enum representing HTTP response status codes and their descriptions. Redirection responses
Enum representing HTTP response status codes and descriptions for ResponsesRedirectionCodes. This file defines the following methods:
to_http_code: Converts the enum variant to its correspondingHttpCode.get_code: Returns the standard code asu16.from_u16: Constructs an enum variant from a givenu16code (first matching standard, then internal).from_internal_code: Constructs an enum variant from a given internalu16code.as_tuple: Returns a unified tuple representation.as_json: Returns a JSON representation.
§Example
use strum_macros::EnumIter;
use simbld_http::responses::CustomResponse;
use simbld_http::traits::get_code_trait::GetCode;
use simbld_http::responses::ResponsesRedirectionCodes;
let example = ResponsesRedirectionCodes::MultipleChoices;
assert_eq!(example.get_code(), 300);
// L'as_tuple retourne une structure UnifiedTuple avec les données du code de réponse
let tuple = example.as_tuple();
assert_eq!(tuple.standard_code, 300);
assert_eq!(tuple.standard_name, "Multiple Choices");Variants§
MultipleChoices
MovedPermanently
Found
SeeOther
NotModified
UseProxy
SwitchProxy
TemporaryRedirect
PermanentRedirect
TooManyRedirects
RedirectMethod
Unassigned
MovedPermanentlyRedirected
MovedTemporarilyRedirected
SeeOtherRedirected
NotModifiedRedirected
UseProxyRedirected
UnusedRedirected
TemporaryRedirectRedirected
PermanentRedirected
TooManyRedirectsRedirected
RedirectMethodRedirected
UserNameOkPasswordNeeded
NoNeedAccountForLogin
SessionKeyNotPresentInHeader
SessionKeyPresentAndNotDecryptableParsable
ServerIsUnwillingToProcessTheRequest
ChallengeResponseAuthenticationOk
ChallengeResponseAuthenticationFailed
LengthRequired
PreconditionFailed
RequestEntityTooLarge
UnsupportedMediaType
RequestedRangeNotSatisfiable
ExpectationFailed
ImATeapot
ErrorAccessingURL
TriggerNotFound
AccessDenied
ConditionFailed
MandatoryParameterIsNull
TheParameterDoesNotExist
DataBLOBShouldNotBeNullForPostMethod
Implementations§
Source§impl ResponsesRedirectionCodes
impl ResponsesRedirectionCodes
Sourcepub fn get_description(&self) -> &'static str
pub fn get_description(&self) -> &'static str
Returns the description associated with the response code.
Sourcepub fn get_all_data(&self) -> (u16, &'static str, &'static str, &'static str)
pub fn get_all_data(&self) -> (u16, &'static str, &'static str, &'static str)
Returns all data associated with the response code as a tuple.
Sourcepub fn into_response(&self) -> CustomResponse
pub fn into_response(&self) -> CustomResponse
Converts the enum variant into a CustomResponse.
Sourcepub fn to_http_code(&self) -> HttpCode
pub fn to_http_code(&self) -> HttpCode
Converts the enum variant into its corresponding HttpCode.
Sourcepub fn internal_code(&self) -> u16
pub fn internal_code(&self) -> u16
Returns the internal code (u16) of the response.
Sourcepub fn from_u16(code: u16) -> Option<Self>
pub fn from_u16(code: u16) -> Option<Self>
Constructs an enum variant from a given u16 code. It first checks standard codes, then internal codes.
Sourcepub fn from_internal_code(code: u16) -> Option<Self>
pub fn from_internal_code(code: u16) -> Option<Self>
Attempts to create a standardized enumeration variant from the HTTP code `U16 ‘’ which is internal to it. returns “none” if no variant corresponds.
Sourcepub fn as_tuple(&self) -> UnifiedTuple
pub fn as_tuple(&self) -> UnifiedTuple
Returns a unified tuple representation.
Trait Implementations§
Source§impl Clone for ResponsesRedirectionCodes
impl Clone for ResponsesRedirectionCodes
Source§fn clone(&self) -> ResponsesRedirectionCodes
fn clone(&self) -> ResponsesRedirectionCodes
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResponsesRedirectionCodes
impl Debug for ResponsesRedirectionCodes
Source§impl From<ResponsesRedirectionCodes> for (u16, &'static str)
Implementation of the From trait for converting the enum into a tuple (u16, &'static str).
impl From<ResponsesRedirectionCodes> for (u16, &'static str)
Implementation of the From trait for converting the enum into a tuple (u16, &'static str).
Source§fn from(value: ResponsesRedirectionCodes) -> Self
fn from(value: ResponsesRedirectionCodes) -> Self
Source§impl GetCode for ResponsesRedirectionCodes
Implementation of the GetCode trait for the enum.
impl GetCode for ResponsesRedirectionCodes
Implementation of the GetCode trait for the enum.
Source§impl IntoThreeFieldsTuple for ResponsesRedirectionCodes
Implementation for converting the enum into a tuple ’(u16, &’static str, &‘static str)’.
impl IntoThreeFieldsTuple for ResponsesRedirectionCodes
Implementation for converting the enum into a tuple ’(u16, &’static str, &‘static str)’.
fn into_three_fields_tuple(self) -> ThreeFieldsTuple
Source§impl IntoTwoFieldsTuple for ResponsesRedirectionCodes
Implementation for converting the enum into a tuple (u16, &'static str).
impl IntoTwoFieldsTuple for ResponsesRedirectionCodes
Implementation for converting the enum into a tuple (u16, &'static str).
fn into_two_fields_tuple(self) -> TwoFieldsTuple
Source§impl Serialize for ResponsesRedirectionCodes
Custom Serialize implementation to include both “type” and “details” fields.
impl Serialize for ResponsesRedirectionCodes
Custom Serialize implementation to include both “type” and “details” fields.