diff --git a/coverage.svg b/coverage.svg index e460277f21..2a5ae9720a 100644 --- a/coverage.svg +++ b/coverage.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/doc/.timestamp b/doc/.timestamp index 9e568e61ee..659cb4ecab 100644 --- a/doc/.timestamp +++ b/doc/.timestamp @@ -1 +1 @@ -Wed Jan 10 11:24:25 UTC 2024 +Mon Jan 22 13:02:50 UTC 2024 diff --git a/doc/gotham_restful/struct.Raw.html b/doc/gotham_restful/struct.Raw.html index 4f871635ce..73a31b66bc 100644 --- a/doc/gotham_restful/struct.Raw.html +++ b/doc/gotham_restful/struct.Raw.html @@ -18,15 +18,15 @@ }
raw: T
§mime: Mime
[StatusCode::OK]
by default.()
if needs_body()
…","The type to parse the body into. Use ()
if needs_body()
…","Take the token from a cookie with the given name.","","","This trait allows to draw routes within an resource. Use …","This trait allows to draw routes within an resource. Use …","This trait adds the resource
method to gotham’s routing. …","This trait adds the resource
method to gotham’s routing. …","","","Contains the error value","Contains the error value","","","The error type returned by the conversion if it was …","","This trait should be implemented for every type that can …","","This trait adds the openapi_spec
and openapi_doc
method to …","Take the token from a header with the given name.","This trait needs to be implemented by every type returned …","","A trait provided to convert a resource’s result to json, …","The request has been performed with an invalid …","This is the return type of a resource that doesn’t …","A no-op extractor that can be used as a default type for …","Contains the success value","Contains the success value","","","The output type that provides the response.","The output type that provides the response.","The type that parses the request parameters. Use …","The type that parses the request parameters. Use …","The type that parses the URI placeholders. Use …","The type that parses the URI placeholders. Use …","This type can be used both as a raw request body, as well …","This is the return type of a resource that only returns a …","A type that can be used inside a request body. Implemented …","","This trait must be implemented for every resource. It …","","","This trait must be implemented for every resource. It …","A response, used to create the final gotham response from.","A type that can be used inside a response body. …","Additional details for IntoResponse to be used with an …","An AuthHandler returning always the same secret. See …","This can be returned from a resource when there is no …","The request has been performed without any kind of …","The auth status is unknown. This is likely because no …","This trait adds the with_openapi
method to gotham’s …","Return a list of supported mime types.","Return a list of supported mime types.","","","The validation will check that the alg
of the header is …","","","If it contains a value, the validation will check that the …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Add a description to the openapi specification. Usually …","Add a description to the openapi specification. Usually …","","","","","","","","","","","","","","","","","","","Create an empty 403 Forbidden Response.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","","","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","","Perform the conversion.","","","","","","The handler for this endpoint.","The handler for this endpoint.","","Returns true
iff the URI contains placeholders. false
by …","Returns true
iff the URI contains placeholders. false
by …","Returns true
iff the URI contains placeholders. false
by …","Returns true
iff the URI contains placeholders. false
by …","Set a custom HTTP header. If a header with this name was …","Set a custom HTTP header. If a header with this name was …","Add an HTTP header to the Response.","Allow manipulating HTTP headers.","Allow manipulating HTTP headers.","The HTTP Verb of this endpoint.","The HTTP Verb of this endpoint.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Turn this into a response that can be returned to the …","This will always be a 204 No Content together with an …","","","","","","","","If it contains a value, the validation will check that the …","Create a Response with mime type json from already …","Return the SHA256-HMAC secret used to verify the JWT token.","","Add some leeway (in seconds) to the exp
and nbf
validation …","Return the mime type of this Response.","","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request parameters should be parsed. …","Returns true
iff the request parameters should be parsed. …","Returns true
iff the request parameters should be parsed. …","Returns true
iff the request parameters should be parsed. …","","","","Create a new Response from raw data.","","Create a 204 No Content Response.","","Register a GET route to path
that returns the OpenAPI …","Register a GET route to path
that returns the OpenAPI …","Replace the automatically generated operation id with a …","Replace the automatically generated operation id with a …","The verb used for generating an operation id if …","","","","Which claims are required to be present before starting …","","","","Return the schema of the response for the given status …","","","Returns the schema of the ()
type.","","","","","Register all methods handled by this resource with the …","Register all methods handled by this resource with the …","Return the status code of this Response.","","All status codes returned by this response. Returns …","All status codes returned by this response. Returns …","","","","","If it contains a value, the validation will check that the …","Return all types that are supported as content types. Use …","Return all types that are supported as content types. Use …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","The URI that this endpoint listens on in gotham’s format.","The URI that this endpoint listens on in gotham’s format.","","Whether to validate the exp
field.","Whether to validate the nbf
field.","","","","Returns true
if the request wants to know the auth status …","Returns true
if the request wants to know the auth status …","Returns true
if the request wants to know the auth status …","Returns true
if the request wants to know the auth status …","","Copy the Origin
header into the Access-Control-Allow-Origin
…","Copy the Access-Control-Request-Headers
header into the …","This is the configuration that the CORS handler will …","Add CORS routing for your path. This is required for …","Specify the allowed headers of the request. It is up to …","Set the Access-Control-Allow-Headers
header to the …","Do not send any Access-Control-Allow-Origin
headers.","Do not send any Access-Control-Allow-Headers
headers.","Specify the allowed origins of the request. It is up to …","Set the Access-Control-Allow-Origin
header to a single …","Send Access-Control-Allow-Origin: *
. Note that browser …","","","","","","","","","","","","","","","","Handle a preflight request on path
for method
. To …","Whether or not the request may be made with supplying …","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Handle CORS for a non-preflight request. This means …","The allowed headers.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","The amount of seconds that the preflight request can be …","","The allowed origins.","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,16,18,66,67,18,0,0,0,0,0,0,0,0,68,69,70,71,72,23,0,0,0,18,0,0,0,16,0,0,68,69,0,23,66,67,66,67,66,67,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,71,71,24,26,54,4,4,54,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,21,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,21,8,16,18,19,8,20,21,22,23,24,4,25,26,16,18,19,8,20,21,22,23,24,4,25,26,0,0,24,25,26,0,0,67,67,21,58,59,0,21,16,18,19,8,20,21,22,23,24,4,25,26,37,37,16,18,19,8,20,21,22,23,23,23,23,24,24,4,25,26,26,26,37,19,72,21,4,8,19,0,66,67,0,66,66,67,67,24,26,37,24,26,66,67,16,18,19,8,20,21,22,23,24,4,25,26,37,71,24,4,25,26,37,70,22,23,54,37,14,19,54,37,4,66,66,67,67,66,66,67,67,8,22,4,37,8,37,16,73,73,67,67,67,4,0,0,54,74,75,70,76,22,23,24,4,25,26,0,77,78,37,70,76,76,22,23,24,25,54,79,79,21,16,18,21,20,25,16,18,19,8,20,21,22,23,24,4,25,26,16,18,21,16,18,21,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,21,16,18,19,8,20,21,22,23,24,4,25,26,37,0,0,66,67,20,54,54,20,21,4,66,66,67,67,80,64,65,0,0,0,65,64,65,0,64,64,64,65,63,63,64,65,63,63,63,64,65,63,64,65,63,81,63,64,65,63,64,65,63,64,65,63,0,63,64,65,63,63,63,63,63,64,65,63,63,63,64,65,63,64,65,63,63,64,65,63],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],0,[[[4,[-2]]],-1,[],[[5,[-1]]]],[[[4,[-2]]],-1,[],[[6,[-1]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[7,-1,[]],[7,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[7,-1,[]],[7,-1,[]],[[[8,[-1,-2]],7,-3],[[11,[[10,[9]]]]],[12,13],[[14,[-1]]],15],[[[16,[-1]]],[[16,[-1]]],[17,13]],[18,18],[19,19],[[[8,[-1,-2]]],[[8,[-1,-2]]],[],17],[20,20],[21,21],[22,22],[[[23,[-1]]],[[23,[-1]]],17],[24,24],[[[4,[-1]]],[[4,[-1]]],17],[25,25],[[[26,[-1]]],[[26,[-1]]],17],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],0,0,[[],24],[[],25],[[],[[26,[-1]]],28],0,0,[[],[[3,[29]]]],[[],[[3,[29]]]],[-1,[[30,[21]]],31],[-1,27,[]],[-1,27,[]],0,[[7,[33,[32]]],27],[[[16,[-1]],34],35,[36,13]],[[18,34],35],[[19,34],35],[[[8,[-1,-2]],34],35,36,36],[[20,34],35],[[21,34],35],[[22,34],35],[[[23,[-1]],34],35,36],[[24,34],35],[[[4,[-1]],34],35,36],[[25,34],35],[[[26,[-1]],34],35,36],[[37,34],35],[[],37],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-2,[[23,[-1]]],[],[0,[38,[-1]]]],[-1,-1,[]],[39,-1,[]],[22,[[23,[-1]]],[]],[-1,-1,[]],[27,24],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,[[26,[-1]]],[]],[39,-1,[]],[-1,-1,[]],[[[41,[40]]],19],[[42,1],[[30,[-1]]],[]],[[42,1],[[30,[-1]]],[]],[[42,1],[[30,[[4,[-1]]]]],[[43,[[41,[40]]]]]],[18,[[8,[-1,-2]]],[12,13],[[14,[-1]],28]],[[[2,[40]]],19],0,[[7,3],44],[[7,3],44],0,[[],45],[[],45],[[],45],[[],45],[[24,-1,46],27,47],[[[26,[-1]],-2,46],27,[],47],[[37,48,46],27],[24,49],[[[26,[-1]]],49,[]],[[],50],[[],50],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[44,[[30,[37]]]]],[]],[24,[[11,[[10,[51]]]]]],[[[4,[-1]]],[[11,[[10,[51]]]]],[[38,[32]]]],[25,[[44,[[30,[37]]]]]],[[[26,[-1]]],[[11,[[10,[51]]]]],52],[37,[[44,[[30,[37]]]]]],[-1,[[30,[37]]],[]],[22,[[30,[37]]]],[[[23,[-1]]],[[30,[37]]],[]],0,[[53,-1],37,[[38,[32]]]],[[-1,7,-2],[[3,[[2,[40]]]]],[],15],[[19,7,-1],[[3,[[2,[40]]]]],15],0,[37,[[3,[1]]]],0,[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[18,54,-2],[[8,[-1,-2]]],[12,13],[[14,[-1]]]],[-1,22,[[38,[29]]]],[[-1,1],[[4,[-1]]],[]],[[53,-1,[3,[1]]],37,[[38,[32]]]],[[[8,[-1,-2]]],[[55,[[8,[-1,-2]]]]],[],[]],[[],37],[[[16,[-1]]],[[30,[-1,22]]],13],[[-1,56],27,[]],[[-1,56],27,[]],[[],[[3,[29]]]],[[],[[3,[29]]]],[[],[[3,[56]]]],0,0,0,0,[[-1,56],27,[]],[[-1,56],27,[]],[53,57],[53,57],[53,57],[53,57],[53,57],[53,57],[53,57],[53,57],0,[-1,27,58],[-1,27,59],[37,53],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],0,[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[7,-1,[]],[7,-1,[]],[7,-1,[]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],0,0,[[],[[61,[56]]]],[[],[[61,[56]]]],0,0,0,0,[-1,27,62],[-1,27,62],[[],45],[[],45],[[],45],[[],45],[[-1,20,-2],27,[],15],0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[[63,7,-1],[[11,[[10,[9]]]]],15],[64,64],[65,65],[63,63],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,56,50],27,[]],0,[[],64],[[],65],[[],63],[[64,34],35],[[65,34],35],[[63,34],35],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[[7,[33,[32]]],27],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[63,[[55,[63]]]],0,[7,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[7,[[3,[-1]]],[]],[-1,60,[]],[-1,60,[]],[-1,60,[]]],"c":[],"p":[[3,"Mime",416],[3,"Vec",417],[4,"Option",418],[3,"Raw",0],[8,"AsMut",419],[8,"AsRef",419],[3,"State",420],[3,"AuthMiddleware",0],[6,"HandlerFuture",421],[3,"Box",422],[3,"Pin",423],[8,"DeserializeOwned",424],[8,"Send",425],[8,"AuthHandler",0],[8,"FnOnce",426],[4,"AuthStatus",0],[8,"Clone",427],[4,"AuthSource",0],[3,"StaticAuthHandler",0],[3,"OpenapiInfo",0],[3,"NoopExtractor",0],[3,"AuthError",0],[4,"AuthErrorOrOther",0],[3,"NoContent",0],[3,"Redirect",0],[3,"Success",0],[15,"tuple"],[8,"Default",428],[3,"String",429],[4,"Result",430],[8,"Deserializer",424],[3,"Body",431],[3,"Response",432],[3,"Formatter",433],[6,"Result",433],[8,"Debug",433],[3,"Response",0],[8,"Into",419],[15,"never"],[15,"u8"],[15,"slice"],[3,"Bytes",434],[8,"From",419],[6,"BoxFuture",435],[15,"bool"],[3,"HeaderValue",436],[8,"IntoHeaderName",437],[3,"HeaderName",438],[3,"HeaderMap",439],[3,"Method",440],[8,"Future",441],[8,"ResponseBody",0],[3,"StatusCode",442],[6,"AuthValidation",0],[6,"Result",443],[15,"str"],[3,"OpenapiSchema",444],[8,"DrawResourceRoutes",0],[8,"DrawResourceRoutesWithSchema",0],[3,"TypeId",445],[4,"Cow",446],[8,"Visitor",447],[3,"CorsConfig",355],[4,"Origin",355],[4,"Headers",355],[8,"Endpoint",0],[8,"EndpointWithSchema",0],[6,"AuthSuccess",0],[6,"AuthResult",0],[8,"IntoResponseError",0],[8,"IntoResponse",0],[8,"FromBody",0],[8,"GetOpenapi",0],[8,"DrawResources",0],[8,"DrawResourcesWithSchema",0],[8,"ResponseSchema",0],[8,"Resource",0],[8,"ResourceWithSchema",0],[8,"RequestBody",0],[8,"WithOpenapi",0],[8,"CorsRoute",355]],"b":[[164,"impl-From%3CF%3E-for-AuthErrorOrOther%3CE%3E"],[167,"impl-From%3CAuthError%3E-for-AuthErrorOrOther%3CE%3E"]]}\
+"gotham_restful":{"doc":"This crate is an extension to the popular gotham web …","t":"DEIDGEEGGNNQQNCCIIIIIINNQQQNIYINIIINDDNNDNQQQQQQDDIYIYYIDIIDDNNILLLLMLLMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLAXLLLXXLLLKKXLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLKLLLLCKKCLLLLLLLLLKKLLLLLLLLLLLLLKLLLLLKLLMLKLMLMLLLLLLLLLLLLLLLKKLLKMXXMKKKKLLLLLLXKKLKLLLLLLMLLLLLLMMLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLXXKKMMMMLLLLLLKNNDIENNNENNLLLLLLLLLLLLLLLKMLLLLLLLLLFMLLLMLMLLLLLLLLLLLLLLLL","n":["AuthError","AuthErrorOrOther","AuthHandler","AuthMiddleware","AuthResult","AuthSource","AuthStatus","AuthSuccess","AuthValidation","Authenticated","AuthorizationHeader","Body","Body","Cookie","CorsConfig","CorsRoute","DrawResourceRoutes","DrawResourceRoutesWithSchema","DrawResources","DrawResourcesWithSchema","Endpoint","EndpointWithSchema","Err","Err","Err","Err","Err","Forbidden","FromBody","FromBody","GetOpenapi","Header","IntoResponse","IntoResponseError","IntoResponseWithSchema","Invalid","NoContent","NoopExtractor","Ok","Ok","OpenapiInfo","Other","Output","Output","Params","Params","Placeholders","Placeholders","Raw","Redirect","RequestBody","RequestBody","Resource","Resource","ResourceError","ResourceWithSchema","Response","ResponseBody","ResponseSchema","StaticAuthHandler","Success","Unauthenticated","Unknown","WithOpenapi","accepted_types","accepted_types","accepted_types","accepted_types","algorithms","as_mut","as_ref","aud","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow","borrow_from","borrow_from","borrow_from","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut_from","borrow_mut_from","borrow_mut_from","call","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","clone_into","cors","create","default","default","default","delete","delete_all","description","description","deserialize","endpoint","endpoint","endpoint","extend","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","forbidden","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from","from_array","from_body","from_body","from_body","from_source","from_vec","gotham","handle","handle","handle_cors","has_placeholders","has_placeholders","has_placeholders","has_placeholders","header","header","header","headers_mut","headers_mut","http_method","http_method","into","into","into","into","into","into","into","into","into","into","into","into","into","into_response","into_response","into_response","into_response","into_response","into_response","into_response_error","into_response_error","into_response_error","iss","json","jwt_secret","jwt_secret","leeway","mime","mime","needs_body","needs_body","needs_body","needs_body","needs_params","needs_params","needs_params","needs_params","new","new","new","new","new_middleware","no_content","ok","openapi_doc","openapi_spec","operation_id","operation_id","operation_verb","raw","read","read_all","required_spec_claims","resource","resource","schema","schema","schema","schema","schema","schema","schema","schema","search","setup","setup","status","status_codes","status_codes","status_codes","status_codes","status_codes","status_codes","status_codes","sub","supported_types","supported_types","supported_types","take_from","take_from","take_from","title","to","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","to_owned","try_borrow_from","try_borrow_from","try_borrow_from","try_borrow_mut_from","try_borrow_mut_from","try_borrow_mut_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_into","try_take_from","try_take_from","try_take_from","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","type_id","update","update_all","uri","uri","urls","validate_exp","validate_nbf","version","visit_type","visit_type","wants_auth","wants_auth","wants_auth","wants_auth","with_openapi","Copy","Copy","CorsConfig","CorsRoute","Headers","List","None","None","Origin","Single","Star","borrow","borrow","borrow","borrow_from","borrow_mut","borrow_mut","borrow_mut","borrow_mut_from","call","clone","clone","clone","clone_into","clone_into","clone_into","cors","credentials","default","default","default","fmt","fmt","fmt","from","from","from","handle_cors","headers","into","into","into","max_age","new_middleware","origin","take_from","to_owned","to_owned","to_owned","try_borrow_from","try_borrow_mut_from","try_from","try_from","try_from","try_into","try_into","try_into","try_take_from","type_id","type_id","type_id"],"q":[[0,"gotham_restful"],[355,"gotham_restful::cors"],[416,"mime"],[417,"alloc::vec"],[418,"core::option"],[419,"core::convert"],[420,"core::convert"],[421,"gotham::handler"],[422,"alloc::boxed"],[423,"core::pin"],[424,"serde::de"],[425,"core::marker"],[426,"core::ops::function"],[427,"core::clone"],[428,"core::default"],[429,"alloc::string"],[430,"core::result"],[431,"serde::de"],[432,"http::response"],[433,"core::fmt"],[434,"core::fmt"],[435,"core::convert"],[436,"http::header::value"],[437,"http::header::map::into_header_name"],[438,"http::header::name"],[439,"http::header::map"],[440,"http::method"],[441,"core::future::future"],[442,"http::status"],[443,"anyhow"],[444,"openapi_type::visitor::openapi"],[445,"core::any"],[446,"alloc::borrow"],[447,"openapi_type::visitor"]],"d":["This is an error type that always yields a 403 Forbidden …","This is an error type that either yields a 403 Forbidden …","This trait will help the auth middleware to determine the …","This is the auth middleware. To use it, first make sure …","This return type can be used to wrap any type implementing …","The source of the authentication token in the request.","The authentication status returned by the auth middleware …","This return type can be used to wrap any type implementing …","","The request has been performed with a valid …","Take the token from the HTTP Authorization header. This is …","The type to parse the body into. Use ()
if needs_body()
…","The type to parse the body into. Use ()
if needs_body()
…","Take the token from a cookie with the given name.","","","This trait allows to draw routes within an resource. Use …","This trait allows to draw routes within an resource. Use …","This trait adds the resource
method to gotham’s routing. …","This trait adds the resource
method to gotham’s routing. …","","","Contains the error value","Contains the error value","","","The error type returned by the conversion if it was …","","This trait should be implemented for every type that can …","","This trait adds the openapi_spec
and openapi_doc
method to …","Take the token from a header with the given name.","This trait needs to be implemented by every type returned …","","A trait provided to convert a resource’s result to json, …","The request has been performed with an invalid …","This is the return type of a resource that doesn’t …","A no-op extractor that can be used as a default type for …","Contains the success value","Contains the success value","","","The output type that provides the response.","The output type that provides the response.","The type that parses the request parameters. Use …","The type that parses the request parameters. Use …","The type that parses the URI placeholders. Use …","The type that parses the URI placeholders. Use …","This type can be used both as a raw request body, as well …","This is the return type of a resource that only returns a …","A type that can be used inside a request body. Implemented …","","This trait must be implemented for every resource. It …","","","This trait must be implemented for every resource. It …","A response, used to create the final gotham response from.","A type that can be used inside a response body. …","Additional details for IntoResponse to be used with an …","An AuthHandler returning always the same secret. See …","This can be returned from a resource when there is no …","The request has been performed without any kind of …","The auth status is unknown. This is likely because no …","This trait adds the with_openapi
method to gotham’s …","Return a list of supported mime types.","Return a list of supported mime types.","","","The validation will check that the alg
of the header is …","","","If it contains a value, the validation will check that the …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Add a description to the openapi specification. Usually …","Add a description to the openapi specification. Usually …","","","","","","","","","","","","","","","","","","","Create an empty 403 Forbidden Response.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Returns the argument unchanged.","","","Returns the argument unchanged.","","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","Returns the argument unchanged.","","Perform the conversion.","","","","","","The handler for this endpoint.","The handler for this endpoint.","","Returns true
iff the URI contains placeholders. false
by …","Returns true
iff the URI contains placeholders. false
by …","Returns true
iff the URI contains placeholders. false
by …","Returns true
iff the URI contains placeholders. false
by …","Set a custom HTTP header. If a header with this name was …","Set a custom HTTP header. If a header with this name was …","Add an HTTP header to the Response.","Allow manipulating HTTP headers.","Allow manipulating HTTP headers.","The HTTP Verb of this endpoint.","The HTTP Verb of this endpoint.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","Turn this into a response that can be returned to the …","This will always be a 204 No Content together with an …","","","","","","","","If it contains a value, the validation will check that the …","Create a Response with mime type json from already …","Return the SHA256-HMAC secret used to verify the JWT token.","","Add some leeway (in seconds) to the exp
and nbf
validation …","Return the mime type of this Response.","","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request body should be parsed. false
…","Returns true
iff the request parameters should be parsed. …","Returns true
iff the request parameters should be parsed. …","Returns true
iff the request parameters should be parsed. …","Returns true
iff the request parameters should be parsed. …","","","","Create a new Response from raw data.","","Create a 204 No Content Response.","","Register a GET route to path
that returns the OpenAPI …","Register a GET route to path
that returns the OpenAPI …","Replace the automatically generated operation id with a …","Replace the automatically generated operation id with a …","The verb used for generating an operation id if …","","","","Which claims are required to be present before starting …","","","","Return the schema of the response for the given status …","","","Returns the schema of the ()
type.","","","","","Register all methods handled by this resource with the …","Register all methods handled by this resource with the …","Return the status code of this Response.","","All status codes returned by this response. Returns …","All status codes returned by this response. Returns …","","","","","If it contains a value, the validation will check that the …","Return all types that are supported as content types. Use …","Return all types that are supported as content types. Use …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","The URI that this endpoint listens on in gotham’s format.","The URI that this endpoint listens on in gotham’s format.","","Whether to validate the exp
field.","Whether to validate the nbf
field.","","","","Returns true
if the request wants to know the auth status …","Returns true
if the request wants to know the auth status …","Returns true
if the request wants to know the auth status …","Returns true
if the request wants to know the auth status …","","Copy the Origin
header into the Access-Control-Allow-Origin
…","Copy the Access-Control-Request-Headers
header into the …","This is the configuration that the CORS handler will …","Add CORS routing for your path. This is required for …","Specify the allowed headers of the request. It is up to …","Set the Access-Control-Allow-Headers
header to the …","Do not send any Access-Control-Allow-Origin
headers.","Do not send any Access-Control-Allow-Headers
headers.","Specify the allowed origins of the request. It is up to …","Set the Access-Control-Allow-Origin
header to a single …","Send Access-Control-Allow-Origin: *
. Note that browser …","","","","","","","","","","","","","","","","Handle a preflight request on path
for method
. To …","Whether or not the request may be made with supplying …","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Handle CORS for a non-preflight request. This means …","The allowed headers.","Calls U::from(self)
.","Calls U::from(self)
.","Calls U::from(self)
.","The amount of seconds that the preflight request can be …","","The allowed origins.","","","","","","","","","","","","","","","",""],"i":[0,0,0,0,0,0,0,0,0,16,18,66,67,18,0,0,0,0,0,0,0,0,68,69,70,71,72,23,0,0,0,18,0,0,0,16,0,0,68,69,0,23,66,67,66,67,66,67,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,71,71,24,26,54,4,4,54,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,21,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,21,8,16,18,19,8,20,21,22,23,24,4,25,26,16,18,19,8,20,21,22,23,24,4,25,26,0,0,24,25,26,0,0,67,67,21,58,59,0,21,16,18,19,8,20,21,22,23,24,4,25,26,37,37,16,18,19,8,20,21,22,23,23,23,23,24,24,4,25,26,26,26,37,19,72,21,4,8,19,0,66,67,0,66,66,67,67,24,26,37,24,26,66,67,16,18,19,8,20,21,22,23,24,4,25,26,37,71,24,4,25,26,37,70,22,23,54,37,14,19,54,37,4,66,66,67,67,66,66,67,67,8,22,4,37,8,37,16,73,73,67,67,67,4,0,0,54,74,75,70,76,22,23,24,4,25,26,0,77,78,37,70,76,76,22,23,24,25,54,79,79,21,16,18,21,20,25,16,18,19,8,20,21,22,23,24,4,25,26,16,18,21,16,18,21,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,19,8,20,21,22,23,24,4,25,26,37,16,18,21,16,18,19,8,20,21,22,23,24,4,25,26,37,0,0,66,67,20,54,54,20,21,4,66,66,67,67,80,64,65,0,0,0,65,64,65,0,64,64,64,65,63,63,64,65,63,63,63,64,65,63,64,65,63,81,63,64,65,63,64,65,63,64,65,63,0,63,64,65,63,63,63,63,63,64,65,63,63,63,64,65,63,64,65,63,63,64,65,63],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],0,[[[4,[-2]]],-1,[],[[5,[-1]]]],[[[4,[-2]]],-1,[],[[6,[-1]]]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[7,-1,[]],[7,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[7,-1,[]],[7,-1,[]],[[[8,[-1,-2]],7,-3],[[11,[[10,[9]]]]],[12,13],[[14,[-1]]],15],[[[16,[-1]]],[[16,[-1]]],[17,13]],[18,18],[19,19],[[[8,[-1,-2]]],[[8,[-1,-2]]],[],17],[20,20],[21,21],[22,22],[[[23,[-1]]],[[23,[-1]]],17],[24,24],[[[4,[-1]]],[[4,[-1]]],17],[25,25],[[[26,[-1]]],[[26,[-1]]],17],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],0,0,[[],24],[[],25],[[],[[26,[-1]]],28],0,0,[[],[[3,[29]]]],[[],[[3,[29]]]],[-1,[[30,[21]]],31],[-1,27,[]],[-1,27,[]],0,[[7,[33,[32]]],27],[[[16,[-1]],34],35,[36,13]],[[18,34],35],[[19,34],35],[[[8,[-1,-2]],34],35,36,36],[[20,34],35],[[21,34],35],[[22,34],35],[[[23,[-1]],34],35,36],[[24,34],35],[[[4,[-1]],34],35,36],[[25,34],35],[[[26,[-1]],34],35,36],[[37,34],35],[[],37],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-2,[[23,[-1]]],[],[0,[38,[-1]]]],[-1,-1,[]],[22,[[23,[-1]]],[]],[39,-1,[]],[-1,-1,[]],[27,24],[-1,-1,[]],[-1,-1,[]],[-1,[[26,[-1]]],[]],[39,-1,[]],[-1,-1,[]],[-1,-1,[]],[[[41,[40]]],19],[[42,1],[[30,[-1]]],[]],[[42,1],[[30,[-1]]],[]],[[42,1],[[30,[[4,[-1]]]]],[[43,[[41,[40]]]]]],[18,[[8,[-1,-2]]],[12,13],[[14,[-1]],28]],[[[2,[40]]],19],0,[[7,3],44],[[7,3],44],0,[[],45],[[],45],[[],45],[[],45],[[24,-1,46],27,47],[[[26,[-1]],-2,46],27,[],47],[[37,48,46],27],[24,49],[[[26,[-1]]],49,[]],[[],50],[[],50],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[44,[[30,[37]]]]],[]],[24,[[11,[[10,[51]]]]]],[[[4,[-1]]],[[11,[[10,[51]]]]],[[38,[32]]]],[25,[[44,[[30,[37]]]]]],[[[26,[-1]]],[[11,[[10,[51]]]]],52],[37,[[44,[[30,[37]]]]]],[-1,[[30,[37]]],[]],[22,[[30,[37]]]],[[[23,[-1]]],[[30,[37]]],[]],0,[[53,-1],37,[[38,[32]]]],[[-1,7,-2],[[3,[[2,[40]]]]],[],15],[[19,7,-1],[[3,[[2,[40]]]]],15],0,[37,[[3,[1]]]],0,[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[],45],[[18,54,-2],[[8,[-1,-2]]],[12,13],[[14,[-1]]]],[-1,22,[[38,[29]]]],[[-1,1],[[4,[-1]]],[]],[[53,-1,[3,[1]]],37,[[38,[32]]]],[[[8,[-1,-2]]],[[55,[[8,[-1,-2]]]]],[],[]],[[],37],[[[16,[-1]]],[[30,[-1,22]]],13],[[-1,56],27,[]],[[-1,56],27,[]],[[],[[3,[29]]]],[[],[[3,[29]]]],[[],[[3,[56]]]],0,0,0,0,[[-1,56],27,[]],[[-1,56],27,[]],[53,57],[53,57],[53,57],[53,57],[53,57],[53,57],[53,57],[53,57],0,[-1,27,58],[-1,27,59],[37,53],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],[[],[[2,[53]]]],0,[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[[],[[3,[[2,[1]]]]]],[7,-1,[]],[7,-1,[]],[7,-1,[]],0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],[-1,60,[]],0,0,[[],[[61,[56]]]],[[],[[61,[56]]]],0,0,0,0,[-1,27,62],[-1,27,62],[[],45],[[],45],[[],45],[[],45],[[-1,20,-2],27,[],15],0,0,0,0,0,0,0,0,0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,-1,[]],[[63,7,-1],[[11,[[10,[9]]]]],15],[64,64],[65,65],[63,63],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,-2],27,[],[]],[[-1,56,50],27,[]],0,[[],64],[[],65],[[],63],[[64,34],35],[[65,34],35],[[63,34],35],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[[7,[33,[32]]],27],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[63,[[55,[63]]]],0,[7,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[7,[[3,[-1]]],[]],[7,[[3,[-1]]],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[-1,[[30,[-2]]],[],[]],[7,[[3,[-1]]],[]],[-1,60,[]],[-1,60,[]],[-1,60,[]]],"c":[],"p":[[3,"Mime",416],[3,"Vec",417],[4,"Option",418],[3,"Raw",0],[8,"AsMut",419],[8,"AsRef",419],[3,"State",420],[3,"AuthMiddleware",0],[6,"HandlerFuture",421],[3,"Box",422],[3,"Pin",423],[8,"DeserializeOwned",424],[8,"Send",425],[8,"AuthHandler",0],[8,"FnOnce",426],[4,"AuthStatus",0],[8,"Clone",427],[4,"AuthSource",0],[3,"StaticAuthHandler",0],[3,"OpenapiInfo",0],[3,"NoopExtractor",0],[3,"AuthError",0],[4,"AuthErrorOrOther",0],[3,"NoContent",0],[3,"Redirect",0],[3,"Success",0],[15,"tuple"],[8,"Default",428],[3,"String",429],[4,"Result",430],[8,"Deserializer",424],[3,"Body",431],[3,"Response",432],[3,"Formatter",433],[6,"Result",433],[8,"Debug",433],[3,"Response",0],[8,"Into",419],[15,"never"],[15,"u8"],[15,"slice"],[3,"Bytes",434],[8,"From",419],[6,"BoxFuture",435],[15,"bool"],[3,"HeaderValue",436],[8,"IntoHeaderName",437],[3,"HeaderName",438],[3,"HeaderMap",439],[3,"Method",440],[8,"Future",441],[8,"ResponseBody",0],[3,"StatusCode",442],[6,"AuthValidation",0],[6,"Result",443],[15,"str"],[3,"OpenapiSchema",444],[8,"DrawResourceRoutes",0],[8,"DrawResourceRoutesWithSchema",0],[3,"TypeId",445],[4,"Cow",446],[8,"Visitor",447],[3,"CorsConfig",355],[4,"Origin",355],[4,"Headers",355],[8,"Endpoint",0],[8,"EndpointWithSchema",0],[6,"AuthSuccess",0],[6,"AuthResult",0],[8,"IntoResponseError",0],[8,"IntoResponse",0],[8,"FromBody",0],[8,"GetOpenapi",0],[8,"DrawResources",0],[8,"DrawResourcesWithSchema",0],[8,"ResponseSchema",0],[8,"Resource",0],[8,"ResourceWithSchema",0],[8,"RequestBody",0],[8,"WithOpenapi",0],[8,"CorsRoute",355]],"b":[[164,"impl-From%3CF%3E-for-AuthErrorOrOther%3CE%3E"],[166,"impl-From%3CAuthError%3E-for-AuthErrorOrOther%3CE%3E"]]}\
}');
if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)};
if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
diff --git a/doc/trait.impl/core/clone/trait.Clone.js b/doc/trait.impl/core/clone/trait.Clone.js
index faa5252218..d11c7b9f58 100644
--- a/doc/trait.impl/core/clone/trait.Clone.js
+++ b/doc/trait.impl/core/clone/trait.Clone.js
@@ -1,3 +1,3 @@
(function() {var implementors = {
-"gotham_restful":[["impl Clone for Redirect"],["impl<E: Clone> Clone for AuthErrorOrOther<E>"],["impl Clone for OpenapiInfo"],["impl Clone for Origin"],["impl<Data, Handler> Clone for AuthMiddleware<Data, Handler>where\n Handler: Clone,"],["impl Clone for AuthError"],["impl Clone for NoContent"],["impl Clone for AuthSource"],["impl Clone for StaticAuthHandler"],["impl Clone for Headers"],["impl<T: Clone> Clone for Raw<T>"],["impl Clone for CorsConfig"],["impl Clone for NoopExtractor"],["impl<T: Clone> Clone for Success<T>"],["impl<T> Clone for AuthStatus<T>where\n T: Clone + Send + 'static,"]]
+"gotham_restful":[["impl Clone for StaticAuthHandler"],["impl Clone for CorsConfig"],["impl<T> Clone for AuthStatus<T>where\n T: Clone + Send + 'static,"],["impl Clone for OpenapiInfo"],["impl Clone for AuthError"],["impl<Data, Handler> Clone for AuthMiddleware<Data, Handler>where\n Handler: Clone,"],["impl Clone for Origin"],["impl Clone for Headers"],["impl<T: Clone> Clone for Raw<T>"],["impl Clone for NoopExtractor"],["impl<E: Clone> Clone for AuthErrorOrOther<E>"],["impl Clone for AuthSource"],["impl Clone for Redirect"],["impl Clone for NoContent"],["impl<T: Clone> Clone for Success<T>"]]
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
\ No newline at end of file
diff --git a/doc/trait.impl/core/default/trait.Default.js b/doc/trait.impl/core/default/trait.Default.js
index 06110f919b..f3e7746312 100644
--- a/doc/trait.impl/core/default/trait.Default.js
+++ b/doc/trait.impl/core/default/trait.Default.js
@@ -1,3 +1,3 @@
(function() {var implementors = {
-"gotham_restful":[["impl Default for Redirect"],["impl Default for Headers"],["impl Default for Origin"],["impl<T: Default> Default for Success<T>"],["impl Default for NoContent"],["impl Default for CorsConfig"]]
+"gotham_restful":[["impl<T: Default> Default for Success<T>"],["impl Default for Redirect"],["impl Default for Origin"],["impl Default for NoContent"],["impl Default for CorsConfig"],["impl Default for Headers"]]
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
\ No newline at end of file
diff --git a/doc/trait.impl/core/fmt/trait.Debug.js b/doc/trait.impl/core/fmt/trait.Debug.js
index 939e70930a..9190c48634 100644
--- a/doc/trait.impl/core/fmt/trait.Debug.js
+++ b/doc/trait.impl/core/fmt/trait.Debug.js
@@ -1,3 +1,3 @@
(function() {var implementors = {
-"gotham_restful":[["impl Debug for Headers"],["impl Debug for AuthSource"],["impl<Data: Debug, Handler: Debug> Debug for AuthMiddleware<Data, Handler>"],["impl<T: Debug> Debug for Success<T>"],["impl Debug for Origin"],["impl Debug for OpenapiInfo"],["impl Debug for Redirect"],["impl<T: Debug + Send + 'static> Debug for AuthStatus<T>"],["impl Debug for StaticAuthHandler"],["impl Debug for NoopExtractor"],["impl<E: Debug> Debug for AuthErrorOrOther<E>"],["impl Debug for AuthError"],["impl Debug for Response"],["impl Debug for NoContent"],["impl Debug for CorsConfig"],["impl<T: Debug> Debug for Raw<T>"]]
+"gotham_restful":[["impl Debug for NoopExtractor"],["impl Debug for CorsConfig"],["impl Debug for Response"],["impl Debug for Redirect"],["impl Debug for AuthSource"],["impl Debug for OpenapiInfo"],["impl<T: Debug> Debug for Success<T>"],["impl<E: Debug> Debug for AuthErrorOrOther<E>"],["impl<T: Debug + Send + 'static> Debug for AuthStatus<T>"],["impl<Data: Debug, Handler: Debug> Debug for AuthMiddleware<Data, Handler>"],["impl Debug for AuthError"],["impl<T: Debug> Debug for Raw<T>"],["impl Debug for Origin"],["impl Debug for Headers"],["impl Debug for StaticAuthHandler"],["impl Debug for NoContent"]]
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
\ No newline at end of file
diff --git a/doc/trait.impl/gotham/middleware/trait.Middleware.js b/doc/trait.impl/gotham/middleware/trait.Middleware.js
index 0502813495..cbd1dc758d 100644
--- a/doc/trait.impl/gotham/middleware/trait.Middleware.js
+++ b/doc/trait.impl/gotham/middleware/trait.Middleware.js
@@ -1,3 +1,3 @@
(function() {var implementors = {
-"gotham_restful":[["impl Middleware for CorsConfig"],["impl<Data, Handler> Middleware for AuthMiddleware<Data, Handler>where\n Data: DeserializeOwned + Send + 'static,\n Handler: AuthHandler<Data>,"]]
+"gotham_restful":[["impl<Data, Handler> Middleware for AuthMiddleware<Data, Handler>where\n Data: DeserializeOwned + Send + 'static,\n Handler: AuthHandler<Data>,"],["impl Middleware for CorsConfig"]]
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
\ No newline at end of file
diff --git a/doc/trait.impl/gotham/middleware/trait.NewMiddleware.js b/doc/trait.impl/gotham/middleware/trait.NewMiddleware.js
index 2a4c70ea51..a0bcdcb1cb 100644
--- a/doc/trait.impl/gotham/middleware/trait.NewMiddleware.js
+++ b/doc/trait.impl/gotham/middleware/trait.NewMiddleware.js
@@ -1,3 +1,3 @@
(function() {var implementors = {
-"gotham_restful":[["impl<Data, Handler> NewMiddleware for AuthMiddleware<Data, Handler>where\n Self: Clone + Middleware + Sync + RefUnwindSafe,"],["impl NewMiddleware for CorsConfig"]]
+"gotham_restful":[["impl NewMiddleware for CorsConfig"],["impl<Data, Handler> NewMiddleware for AuthMiddleware<Data, Handler>where\n Self: Clone + Middleware + Sync + RefUnwindSafe,"]]
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
\ No newline at end of file
diff --git a/doc/trait.impl/gotham/state/data/trait.StateData.js b/doc/trait.impl/gotham/state/data/trait.StateData.js
index ac1c5cf641..ce5a8b61b9 100644
--- a/doc/trait.impl/gotham/state/data/trait.StateData.js
+++ b/doc/trait.impl/gotham/state/data/trait.StateData.js
@@ -1,3 +1,3 @@
(function() {var implementors = {
-"gotham_restful":[["impl StateData for AuthSource"],["impl<T: Send + 'static> StateData for AuthStatus<T>"],["impl StateData for CorsConfig"],["impl StateData for NoopExtractor"]]
+"gotham_restful":[["impl<T: Send + 'static> StateData for AuthStatus<T>"],["impl StateData for CorsConfig"],["impl StateData for AuthSource"],["impl StateData for NoopExtractor"]]
};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
\ No newline at end of file
diff --git a/doc/type.impl/core/result/enum.Result.js b/doc/type.impl/core/result/enum.Result.js
index 04a5b39fcb..bf2631c610 100644
--- a/doc/type.impl/core/result/enum.Result.js
+++ b/doc/type.impl/core/result/enum.Result.js
@@ -1,3 +1,3 @@
(function() {var type_impls = {
-"gotham_restful":[["Returns true
if the result is Ok
and the value inside of it matches a predicate.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.is_ok_and(|x| x > 1), true);\n\nlet x: Result<u32, &str> = Ok(0);\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<u32, &str> = Err("hey");\nassert_eq!(x.is_ok_and(|x| x > 1), false);
Returns true
if the result is Err
and the value inside of it matches a predicate.
use std::io::{Error, ErrorKind};\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, Error> = Ok(123);\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
Converts from Result<T, E>
to Option<E>
.
Converts self
into an Option<E>
, consuming self
,\nand discarding the success value, if any.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.err(), None);\n\nlet x: Result<u32, &str> = Err("Nothing here");\nassert_eq!(x.err(), Some("Nothing here"));
Converts from &Result<T, E>
to Result<&T, &E>
.
Produces a new Result
, containing a reference\ninto the original, leaving the original in place.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.as_ref(), Ok(&2));\n\nlet x: Result<u32, &str> = Err("Error");\nassert_eq!(x.as_ref(), Err(&"Error"));
Converts from &mut Result<T, E>
to Result<&mut T, &mut E>
.
fn mutate(r: &mut Result<i32, i32>) {\n match r.as_mut() {\n Ok(v) => *v = 42,\n Err(e) => *e = 0,\n }\n}\n\nlet mut x: Result<i32, i32> = Ok(2);\nmutate(&mut x);\nassert_eq!(x.unwrap(), 42);\n\nlet mut x: Result<i32, i32> = Err(13);\nmutate(&mut x);\nassert_eq!(x.unwrap_err(), 0);
Maps a Result<T, E>
to Result<U, E>
by applying a function to a\ncontained Ok
value, leaving an Err
value untouched.
This function can be used to compose the results of two functions.
\nPrint the numbers on each line of a string multiplied by two.
\n\nlet line = "1\\n2\\n3\\n4\\n";\n\nfor num in line.lines() {\n match num.parse::<i32>().map(|i| i * 2) {\n Ok(n) => println!("{n}"),\n Err(..) => {}\n }\n}
Returns the provided default (if Err
), or\napplies a function to the contained value (if Ok
).
Arguments passed to map_or
are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use map_or_else
,\nwhich is lazily evaluated.
let x: Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or(42, |v| v.len()), 3);\n\nlet x: Result<&str, _> = Err("bar");\nassert_eq!(x.map_or(42, |v| v.len()), 42);
Maps a Result<T, E>
to U
by applying fallback function default
to\na contained Err
value, or function f
to a contained Ok
value.
This function can be used to unpack a successful result\nwhile handling an error.
\nlet k = 21;\n\nlet x : Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);\n\nlet x : Result<&str, _> = Err("bar");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
Maps a Result<T, E>
to Result<T, F>
by applying a function to a\ncontained Err
value, leaving an Ok
value untouched.
This function can be used to pass through a successful result while handling\nan error.
\nfn stringify(x: u32) -> String { format!("error code: {x}") }\n\nlet x: Result<u32, u32> = Ok(2);\nassert_eq!(x.map_err(stringify), Ok(2));\n\nlet x: Result<u32, u32> = Err(13);\nassert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
result_option_inspect
)result_option_inspect
)Converts from Result<T, E>
(or &Result<T, E>
) to Result<&<T as Deref>::Target, &E>
.
Coerces the Ok
variant of the original Result
via Deref
\nand returns the new Result
.
let x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&str, &u32> = Ok("hello");\nassert_eq!(x.as_deref(), y);\n\nlet x: Result<String, u32> = Err(42);\nlet y: Result<&str, &u32> = Err(&42);\nassert_eq!(x.as_deref(), y);
Converts from Result<T, E>
(or &mut Result<T, E>
) to Result<&mut <T as DerefMut>::Target, &mut E>
.
Coerces the Ok
variant of the original Result
via DerefMut
\nand returns the new Result
.
let mut s = "HELLO".to_string();\nlet mut x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&mut str, &mut u32> = Ok(&mut s);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);\n\nlet mut i = 42;\nlet mut x: Result<String, u32> = Err(42);\nlet y: Result<&mut str, &mut u32> = Err(&mut i);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
Returns an iterator over the possibly contained value.
\nThe iterator yields one value if the result is Result::Ok
, otherwise none.
let x: Result<u32, &str> = Ok(7);\nassert_eq!(x.iter().next(), Some(&7));\n\nlet x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter().next(), None);
Returns a mutable iterator over the possibly contained value.
\nThe iterator yields one value if the result is Result::Ok
, otherwise none.
let mut x: Result<u32, &str> = Ok(7);\nmatch x.iter_mut().next() {\n Some(v) => *v = 40,\n None => {},\n}\nassert_eq!(x, Ok(40));\n\nlet mut x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter_mut().next(), None);
Returns the contained Ok
value, consuming the self
value.
Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err
\ncase explicitly, or call unwrap_or
, unwrap_or_else
, or\nunwrap_or_default
.
Panics if the value is an Err
, with a panic message including the\npassed message, and the content of the Err
.
let x: Result<u32, &str> = Err("emergency failure");\nx.expect("Testing expect"); // panics with `Testing expect: emergency failure`
We recommend that expect
messages are used to describe the reason you\nexpect the Result
should be Ok
.
let path = std::env::var("IMPORTANT_PATH")\n .expect("env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`");
Hint: If you’re having trouble remembering how to phrase expect\nerror messages remember to focus on the word “should” as in “env\nvariable should be set by blah” or “the given binary should be available\nand executable by the current user”.
\nFor more detail on expect message styles and the reasoning behind our recommendation please\nrefer to the section on “Common Message\nStyles” in the\nstd::error
module docs.
Returns the contained Ok
value, consuming the self
value.
Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err
\ncase explicitly, or call unwrap_or
, unwrap_or_else
, or\nunwrap_or_default
.
Panics if the value is an Err
, with a panic message provided by the\nErr
’s value.
Basic usage:
\n\nlet x: Result<u32, &str> = Ok(2);\nassert_eq!(x.unwrap(), 2);
let x: Result<u32, &str> = Err("emergency failure");\nx.unwrap(); // panics with `emergency failure`
Returns the contained Ok
value or a default
Consumes the self
argument then, if Ok
, returns the contained\nvalue, otherwise if Err
, returns the default value for that\ntype.
Converts a string to an integer, turning poorly-formed strings\ninto 0 (the default value for integers). parse
converts\na string to any other type that implements FromStr
, returning an\nErr
on error.
let good_year_from_input = "1909";\nlet bad_year_from_input = "190blarg";\nlet good_year = good_year_from_input.parse().unwrap_or_default();\nlet bad_year = bad_year_from_input.parse().unwrap_or_default();\n\nassert_eq!(1909, good_year);\nassert_eq!(0, bad_year);
Returns the contained Err
value, consuming the self
value.
Panics if the value is an Ok
, with a panic message including the\npassed message, and the content of the Ok
.
let x: Result<u32, &str> = Ok(10);\nx.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
Returns the contained Err
value, consuming the self
value.
Panics if the value is an Ok
, with a custom panic message provided\nby the Ok
’s value.
let x: Result<u32, &str> = Ok(2);\nx.unwrap_err(); // panics with `2`
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(x.unwrap_err(), "emergency failure");
unwrap_infallible
)Returns the contained Ok
value, but never panics.
Unlike unwrap
, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap
as a maintainability safeguard that will fail\nto compile if the error type of the Result
is later changed\nto an error that can actually occur.
\nfn only_good_news() -> Result<String, !> {\n Ok("this is fine".into())\n}\n\nlet s: String = only_good_news().into_ok();\nprintln!("{s}");
unwrap_infallible
)Returns the contained Err
value, but never panics.
Unlike unwrap_err
, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap_err
as a maintainability safeguard that will fail\nto compile if the ok type of the Result
is later changed\nto a type that can actually occur.
\nfn only_bad_news() -> Result<!, String> {\n Err("Oops, it failed".into())\n}\n\nlet error: String = only_bad_news().into_err();\nprintln!("{error}");
Returns res
if the result is Ok
, otherwise returns the Err
value of self
.
Arguments passed to and
are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use and_then
, which is\nlazily evaluated.
let x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("late error"));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<&str, &str> = Ok("foo");\nassert_eq!(x.and(y), Err("early error"));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("not a 2"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Ok("different result type");\nassert_eq!(x.and(y), Ok("different result type"));
Calls op
if the result is Ok
, otherwise returns the Err
value of self
.
This function can be used for control flow based on Result
values.
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {\n x.checked_mul(x).map(|sq| sq.to_string()).ok_or("overflowed")\n}\n\nassert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));\nassert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err("overflowed"));\nassert_eq!(Err("not a number").and_then(sq_then_to_string), Err("not a number"));
Often used to chain fallible operations that may return Err
.
use std::{io::ErrorKind, path::Path};\n\n// Note: on Windows "/" maps to "C:\\"\nlet root_modified_time = Path::new("/").metadata().and_then(|md| md.modified());\nassert!(root_modified_time.is_ok());\n\nlet should_fail = Path::new("/bad/path").metadata().and_then(|md| md.modified());\nassert!(should_fail.is_err());\nassert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
Returns res
if the result is Err
, otherwise returns the Ok
value of self
.
Arguments passed to or
are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use or_else
, which is\nlazily evaluated.
let x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<u32, &str> = Ok(2);\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Err("late error"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Ok(100);\nassert_eq!(x.or(y), Ok(2));
Calls op
if the result is Err
, otherwise returns the Ok
value of self
.
This function can be used for control flow based on result values.
\nfn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }\nfn err(x: u32) -> Result<u32, u32> { Err(x) }\n\nassert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));\nassert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));\nassert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));\nassert_eq!(Err(3).or_else(err).or_else(err), Err(3));
Returns the contained Ok
value or a provided default.
Arguments passed to unwrap_or
are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use unwrap_or_else
,\nwhich is lazily evaluated.
let default = 2;\nlet x: Result<u32, &str> = Ok(9);\nassert_eq!(x.unwrap_or(default), 9);\n\nlet x: Result<u32, &str> = Err("error");\nassert_eq!(x.unwrap_or(default), default);
Returns the contained Ok
value, consuming the self
value,\nwithout checking that the value is not an Err
.
Calling this method on an Err
is undefined behavior.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(unsafe { x.unwrap_unchecked() }, 2);
let x: Result<u32, &str> = Err("emergency failure");\nunsafe { x.unwrap_unchecked(); } // Undefined behavior!
Returns the contained Err
value, consuming the self
value,\nwithout checking that the value is not an Ok
.
Calling this method on an Ok
is undefined behavior.
let x: Result<u32, &str> = Ok(2);\nunsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(unsafe { x.unwrap_err_unchecked() }, "emergency failure");
Maps a Result<&mut T, E>
to a Result<T, E>
by copying the contents of the\nOk
part.
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
Maps a Result<&mut T, E>
to a Result<T, E>
by cloning the contents of the\nOk
part.
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
Transposes a Result
of an Option
into an Option
of a Result
.
Ok(None)
will be mapped to None
.\nOk(Some(_))
and Err(_)
will be mapped to Some(Ok(_))
and Some(Err(_))
.
#[derive(Debug, Eq, PartialEq)]\nstruct SomeErr;\n\nlet x: Result<Option<i32>, SomeErr> = Ok(Some(5));\nlet y: Option<Result<i32, SomeErr>> = Some(Ok(5));\nassert_eq!(x.transpose(), y);
result_flattening
)Converts from Result<Result<T, E>, E>
to Result<T, E>
#![feature(result_flattening)]\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));\nassert_eq!(Ok("hello"), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));\nassert_eq!(Err(6), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Err(6);\nassert_eq!(Err(6), x.flatten());
Flattening only removes one level of nesting at a time:
\n\n#![feature(result_flattening)]\nlet x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok("hello")));\nassert_eq!(Ok(Ok("hello")), x.flatten());\nassert_eq!(Ok("hello"), x.flatten().flatten());
try_trait_v2
)Residual
type. Read moretry_trait_v2
)?
when not short-circuiting.try_trait_v2
)FromResidual::from_residual
\nas part of ?
when short-circuiting. Read moretry_trait_v2
)Output
type. Read moretry_trait_v2
)?
to decide whether the operator should produce a value\n(because this returned ControlFlow::Continue
)\nor propagate a value back to the caller\n(because this returned ControlFlow::Break
). Read moreTakes each element in the Iterator
: if it is an Err
, no further\nelements are taken, and the Err
is returned. Should no Err
occur, a\ncontainer with the values of each Result
is returned.
Here is an example which increments every integer in a vector,\nchecking for overflow:
\n\nlet v = vec![1, 2];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n x.checked_add(1).ok_or("Overflow!")\n).collect();\nassert_eq!(res, Ok(vec![2, 3]));
Here is another example that tries to subtract one from another list\nof integers, this time checking for underflow:
\n\nlet v = vec![1, 2, 0];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n x.checked_sub(1).ok_or("Underflow!")\n).collect();\nassert_eq!(res, Err("Underflow!"));
Here is a variation on the previous example, showing that no\nfurther elements are taken from iter
after the first Err
.
let v = vec![3, 2, 1, 10];\nlet mut shared = 0;\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {\n shared += x;\n x.checked_sub(2).ok_or("Underflow!")\n}).collect();\nassert_eq!(res, Err("Underflow!"));\nassert_eq!(shared, 6);
Since the third element caused an underflow, no further elements were taken,\nso the final value of shared
is 6 (= 3 + 2 + 1
), not 16.
Returns a consuming iterator over the possibly contained value.
\nThe iterator yields one value if the result is Result::Ok
, otherwise none.
let x: Result<u32, &str> = Ok(5);\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, [5]);\n\nlet x: Result<u32, &str> = Err("nothing!");\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, []);
Takes each element in the Iterator
: if it is an Err
, no further\nelements are taken, and the Err
is returned. Should no Err
\noccur, the sum of all elements is returned.
This sums up every integer in a vector, rejecting the sum if a negative\nelement is encountered:
\n\nlet f = |&x: &i32| if x < 0 { Err("Negative element found") } else { Ok(x) };\nlet v = vec![1, 2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Ok(3));\nlet v = vec![1, -2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Err("Negative element found"));
self
and other
) and is used by the <=
\noperator. Read moreTakes each element in the Iterator
: if it is an Err
, no further\nelements are taken, and the Err
is returned. Should no Err
\noccur, the product of all elements is returned.
This multiplies each number in a vector of strings,\nif a string could not be parsed the operation returns Err
:
let nums = vec!["5", "10", "1", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert_eq!(total, Ok(100));\nlet nums = vec!["5", "10", "one", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert!(total.is_err());
map_err(|err| HandlerError::from(err).with_status(status_code))
.hyper::Response
[StatusCode::OK]
by default.[StatusCode::OK]
by default.[StatusCode::OK]
by default.[StatusCode::OK]
by default.Returns true
if the result is Ok
and the value inside of it matches a predicate.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.is_ok_and(|x| x > 1), true);\n\nlet x: Result<u32, &str> = Ok(0);\nassert_eq!(x.is_ok_and(|x| x > 1), false);\n\nlet x: Result<u32, &str> = Err("hey");\nassert_eq!(x.is_ok_and(|x| x > 1), false);
Returns true
if the result is Err
and the value inside of it matches a predicate.
use std::io::{Error, ErrorKind};\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);\n\nlet x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, "!"));\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);\n\nlet x: Result<u32, Error> = Ok(123);\nassert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
Converts from Result<T, E>
to Option<E>
.
Converts self
into an Option<E>
, consuming self
,\nand discarding the success value, if any.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.err(), None);\n\nlet x: Result<u32, &str> = Err("Nothing here");\nassert_eq!(x.err(), Some("Nothing here"));
Converts from &Result<T, E>
to Result<&T, &E>
.
Produces a new Result
, containing a reference\ninto the original, leaving the original in place.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(x.as_ref(), Ok(&2));\n\nlet x: Result<u32, &str> = Err("Error");\nassert_eq!(x.as_ref(), Err(&"Error"));
Converts from &mut Result<T, E>
to Result<&mut T, &mut E>
.
fn mutate(r: &mut Result<i32, i32>) {\n match r.as_mut() {\n Ok(v) => *v = 42,\n Err(e) => *e = 0,\n }\n}\n\nlet mut x: Result<i32, i32> = Ok(2);\nmutate(&mut x);\nassert_eq!(x.unwrap(), 42);\n\nlet mut x: Result<i32, i32> = Err(13);\nmutate(&mut x);\nassert_eq!(x.unwrap_err(), 0);
Maps a Result<T, E>
to Result<U, E>
by applying a function to a\ncontained Ok
value, leaving an Err
value untouched.
This function can be used to compose the results of two functions.
\nPrint the numbers on each line of a string multiplied by two.
\n\nlet line = "1\\n2\\n3\\n4\\n";\n\nfor num in line.lines() {\n match num.parse::<i32>().map(|i| i * 2) {\n Ok(n) => println!("{n}"),\n Err(..) => {}\n }\n}
Returns the provided default (if Err
), or\napplies a function to the contained value (if Ok
).
Arguments passed to map_or
are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use map_or_else
,\nwhich is lazily evaluated.
let x: Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or(42, |v| v.len()), 3);\n\nlet x: Result<&str, _> = Err("bar");\nassert_eq!(x.map_or(42, |v| v.len()), 42);
Maps a Result<T, E>
to U
by applying fallback function default
to\na contained Err
value, or function f
to a contained Ok
value.
This function can be used to unpack a successful result\nwhile handling an error.
\nlet k = 21;\n\nlet x : Result<_, &str> = Ok("foo");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);\n\nlet x : Result<&str, _> = Err("bar");\nassert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
Maps a Result<T, E>
to Result<T, F>
by applying a function to a\ncontained Err
value, leaving an Ok
value untouched.
This function can be used to pass through a successful result while handling\nan error.
\nfn stringify(x: u32) -> String { format!("error code: {x}") }\n\nlet x: Result<u32, u32> = Ok(2);\nassert_eq!(x.map_err(stringify), Ok(2));\n\nlet x: Result<u32, u32> = Err(13);\nassert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
result_option_inspect
)result_option_inspect
)Converts from Result<T, E>
(or &Result<T, E>
) to Result<&<T as Deref>::Target, &E>
.
Coerces the Ok
variant of the original Result
via Deref
\nand returns the new Result
.
let x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&str, &u32> = Ok("hello");\nassert_eq!(x.as_deref(), y);\n\nlet x: Result<String, u32> = Err(42);\nlet y: Result<&str, &u32> = Err(&42);\nassert_eq!(x.as_deref(), y);
Converts from Result<T, E>
(or &mut Result<T, E>
) to Result<&mut <T as DerefMut>::Target, &mut E>
.
Coerces the Ok
variant of the original Result
via DerefMut
\nand returns the new Result
.
let mut s = "HELLO".to_string();\nlet mut x: Result<String, u32> = Ok("hello".to_string());\nlet y: Result<&mut str, &mut u32> = Ok(&mut s);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);\n\nlet mut i = 42;\nlet mut x: Result<String, u32> = Err(42);\nlet y: Result<&mut str, &mut u32> = Err(&mut i);\nassert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
Returns an iterator over the possibly contained value.
\nThe iterator yields one value if the result is Result::Ok
, otherwise none.
let x: Result<u32, &str> = Ok(7);\nassert_eq!(x.iter().next(), Some(&7));\n\nlet x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter().next(), None);
Returns a mutable iterator over the possibly contained value.
\nThe iterator yields one value if the result is Result::Ok
, otherwise none.
let mut x: Result<u32, &str> = Ok(7);\nmatch x.iter_mut().next() {\n Some(v) => *v = 40,\n None => {},\n}\nassert_eq!(x, Ok(40));\n\nlet mut x: Result<u32, &str> = Err("nothing!");\nassert_eq!(x.iter_mut().next(), None);
Returns the contained Ok
value, consuming the self
value.
Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err
\ncase explicitly, or call unwrap_or
, unwrap_or_else
, or\nunwrap_or_default
.
Panics if the value is an Err
, with a panic message including the\npassed message, and the content of the Err
.
let x: Result<u32, &str> = Err("emergency failure");\nx.expect("Testing expect"); // panics with `Testing expect: emergency failure`
We recommend that expect
messages are used to describe the reason you\nexpect the Result
should be Ok
.
let path = std::env::var("IMPORTANT_PATH")\n .expect("env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`");
Hint: If you’re having trouble remembering how to phrase expect\nerror messages remember to focus on the word “should” as in “env\nvariable should be set by blah” or “the given binary should be available\nand executable by the current user”.
\nFor more detail on expect message styles and the reasoning behind our recommendation please\nrefer to the section on “Common Message\nStyles” in the\nstd::error
module docs.
Returns the contained Ok
value, consuming the self
value.
Because this function may panic, its use is generally discouraged.\nInstead, prefer to use pattern matching and handle the Err
\ncase explicitly, or call unwrap_or
, unwrap_or_else
, or\nunwrap_or_default
.
Panics if the value is an Err
, with a panic message provided by the\nErr
’s value.
Basic usage:
\n\nlet x: Result<u32, &str> = Ok(2);\nassert_eq!(x.unwrap(), 2);
let x: Result<u32, &str> = Err("emergency failure");\nx.unwrap(); // panics with `emergency failure`
Returns the contained Ok
value or a default
Consumes the self
argument then, if Ok
, returns the contained\nvalue, otherwise if Err
, returns the default value for that\ntype.
Converts a string to an integer, turning poorly-formed strings\ninto 0 (the default value for integers). parse
converts\na string to any other type that implements FromStr
, returning an\nErr
on error.
let good_year_from_input = "1909";\nlet bad_year_from_input = "190blarg";\nlet good_year = good_year_from_input.parse().unwrap_or_default();\nlet bad_year = bad_year_from_input.parse().unwrap_or_default();\n\nassert_eq!(1909, good_year);\nassert_eq!(0, bad_year);
Returns the contained Err
value, consuming the self
value.
Panics if the value is an Ok
, with a panic message including the\npassed message, and the content of the Ok
.
let x: Result<u32, &str> = Ok(10);\nx.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
Returns the contained Err
value, consuming the self
value.
Panics if the value is an Ok
, with a custom panic message provided\nby the Ok
’s value.
let x: Result<u32, &str> = Ok(2);\nx.unwrap_err(); // panics with `2`
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(x.unwrap_err(), "emergency failure");
unwrap_infallible
)Returns the contained Ok
value, but never panics.
Unlike unwrap
, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap
as a maintainability safeguard that will fail\nto compile if the error type of the Result
is later changed\nto an error that can actually occur.
\nfn only_good_news() -> Result<String, !> {\n Ok("this is fine".into())\n}\n\nlet s: String = only_good_news().into_ok();\nprintln!("{s}");
unwrap_infallible
)Returns the contained Err
value, but never panics.
Unlike unwrap_err
, this method is known to never panic on the\nresult types it is implemented for. Therefore, it can be used\ninstead of unwrap_err
as a maintainability safeguard that will fail\nto compile if the ok type of the Result
is later changed\nto a type that can actually occur.
\nfn only_bad_news() -> Result<!, String> {\n Err("Oops, it failed".into())\n}\n\nlet error: String = only_bad_news().into_err();\nprintln!("{error}");
Returns res
if the result is Ok
, otherwise returns the Err
value of self
.
Arguments passed to and
are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use and_then
, which is\nlazily evaluated.
let x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("late error"));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<&str, &str> = Ok("foo");\nassert_eq!(x.and(y), Err("early error"));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<&str, &str> = Err("late error");\nassert_eq!(x.and(y), Err("not a 2"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<&str, &str> = Ok("different result type");\nassert_eq!(x.and(y), Ok("different result type"));
Calls op
if the result is Ok
, otherwise returns the Err
value of self
.
This function can be used for control flow based on Result
values.
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {\n x.checked_mul(x).map(|sq| sq.to_string()).ok_or("overflowed")\n}\n\nassert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));\nassert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err("overflowed"));\nassert_eq!(Err("not a number").and_then(sq_then_to_string), Err("not a number"));
Often used to chain fallible operations that may return Err
.
use std::{io::ErrorKind, path::Path};\n\n// Note: on Windows "/" maps to "C:\\"\nlet root_modified_time = Path::new("/").metadata().and_then(|md| md.modified());\nassert!(root_modified_time.is_ok());\n\nlet should_fail = Path::new("/bad/path").metadata().and_then(|md| md.modified());\nassert!(should_fail.is_err());\nassert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
Returns res
if the result is Err
, otherwise returns the Ok
value of self
.
Arguments passed to or
are eagerly evaluated; if you are passing the\nresult of a function call, it is recommended to use or_else
, which is\nlazily evaluated.
let x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("early error");\nlet y: Result<u32, &str> = Ok(2);\nassert_eq!(x.or(y), Ok(2));\n\nlet x: Result<u32, &str> = Err("not a 2");\nlet y: Result<u32, &str> = Err("late error");\nassert_eq!(x.or(y), Err("late error"));\n\nlet x: Result<u32, &str> = Ok(2);\nlet y: Result<u32, &str> = Ok(100);\nassert_eq!(x.or(y), Ok(2));
Calls op
if the result is Err
, otherwise returns the Ok
value of self
.
This function can be used for control flow based on result values.
\nfn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }\nfn err(x: u32) -> Result<u32, u32> { Err(x) }\n\nassert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));\nassert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));\nassert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));\nassert_eq!(Err(3).or_else(err).or_else(err), Err(3));
Returns the contained Ok
value or a provided default.
Arguments passed to unwrap_or
are eagerly evaluated; if you are passing\nthe result of a function call, it is recommended to use unwrap_or_else
,\nwhich is lazily evaluated.
let default = 2;\nlet x: Result<u32, &str> = Ok(9);\nassert_eq!(x.unwrap_or(default), 9);\n\nlet x: Result<u32, &str> = Err("error");\nassert_eq!(x.unwrap_or(default), default);
Returns the contained Ok
value, consuming the self
value,\nwithout checking that the value is not an Err
.
Calling this method on an Err
is undefined behavior.
let x: Result<u32, &str> = Ok(2);\nassert_eq!(unsafe { x.unwrap_unchecked() }, 2);
let x: Result<u32, &str> = Err("emergency failure");\nunsafe { x.unwrap_unchecked(); } // Undefined behavior!
Returns the contained Err
value, consuming the self
value,\nwithout checking that the value is not an Ok
.
Calling this method on an Ok
is undefined behavior.
let x: Result<u32, &str> = Ok(2);\nunsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
let x: Result<u32, &str> = Err("emergency failure");\nassert_eq!(unsafe { x.unwrap_err_unchecked() }, "emergency failure");
Maps a Result<&mut T, E>
to a Result<T, E>
by copying the contents of the\nOk
part.
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet copied = x.copied();\nassert_eq!(copied, Ok(12));
Maps a Result<&mut T, E>
to a Result<T, E>
by cloning the contents of the\nOk
part.
let mut val = 12;\nlet x: Result<&mut i32, i32> = Ok(&mut val);\nassert_eq!(x, Ok(&mut 12));\nlet cloned = x.cloned();\nassert_eq!(cloned, Ok(12));
Transposes a Result
of an Option
into an Option
of a Result
.
Ok(None)
will be mapped to None
.\nOk(Some(_))
and Err(_)
will be mapped to Some(Ok(_))
and Some(Err(_))
.
#[derive(Debug, Eq, PartialEq)]\nstruct SomeErr;\n\nlet x: Result<Option<i32>, SomeErr> = Ok(Some(5));\nlet y: Option<Result<i32, SomeErr>> = Some(Ok(5));\nassert_eq!(x.transpose(), y);
result_flattening
)Converts from Result<Result<T, E>, E>
to Result<T, E>
#![feature(result_flattening)]\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));\nassert_eq!(Ok("hello"), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));\nassert_eq!(Err(6), x.flatten());\n\nlet x: Result<Result<&'static str, u32>, u32> = Err(6);\nassert_eq!(Err(6), x.flatten());
Flattening only removes one level of nesting at a time:
\n\n#![feature(result_flattening)]\nlet x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok("hello")));\nassert_eq!(Ok(Ok("hello")), x.flatten());\nassert_eq!(Ok("hello"), x.flatten().flatten());
try_trait_v2
)Residual
type. Read moretry_trait_v2
)?
when not short-circuiting.try_trait_v2
)FromResidual::from_residual
\nas part of ?
when short-circuiting. Read moretry_trait_v2
)Output
type. Read moretry_trait_v2
)?
to decide whether the operator should produce a value\n(because this returned ControlFlow::Continue
)\nor propagate a value back to the caller\n(because this returned ControlFlow::Break
). Read moreTakes each element in the Iterator
: if it is an Err
, no further\nelements are taken, and the Err
is returned. Should no Err
occur, a\ncontainer with the values of each Result
is returned.
Here is an example which increments every integer in a vector,\nchecking for overflow:
\n\nlet v = vec![1, 2];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n x.checked_add(1).ok_or("Overflow!")\n).collect();\nassert_eq!(res, Ok(vec![2, 3]));
Here is another example that tries to subtract one from another list\nof integers, this time checking for underflow:
\n\nlet v = vec![1, 2, 0];\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|\n x.checked_sub(1).ok_or("Underflow!")\n).collect();\nassert_eq!(res, Err("Underflow!"));
Here is a variation on the previous example, showing that no\nfurther elements are taken from iter
after the first Err
.
let v = vec![3, 2, 1, 10];\nlet mut shared = 0;\nlet res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {\n shared += x;\n x.checked_sub(2).ok_or("Underflow!")\n}).collect();\nassert_eq!(res, Err("Underflow!"));\nassert_eq!(shared, 6);
Since the third element caused an underflow, no further elements were taken,\nso the final value of shared
is 6 (= 3 + 2 + 1
), not 16.
Returns a consuming iterator over the possibly contained value.
\nThe iterator yields one value if the result is Result::Ok
, otherwise none.
let x: Result<u32, &str> = Ok(5);\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, [5]);\n\nlet x: Result<u32, &str> = Err("nothing!");\nlet v: Vec<u32> = x.into_iter().collect();\nassert_eq!(v, []);
Takes each element in the Iterator
: if it is an Err
, no further\nelements are taken, and the Err
is returned. Should no Err
\noccur, the sum of all elements is returned.
This sums up every integer in a vector, rejecting the sum if a negative\nelement is encountered:
\n\nlet f = |&x: &i32| if x < 0 { Err("Negative element found") } else { Ok(x) };\nlet v = vec![1, 2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Ok(3));\nlet v = vec![1, -2];\nlet res: Result<i32, _> = v.iter().map(f).sum();\nassert_eq!(res, Err("Negative element found"));
self
and other
) and is used by the <=
\noperator. Read moreTakes each element in the Iterator
: if it is an Err
, no further\nelements are taken, and the Err
is returned. Should no Err
\noccur, the product of all elements is returned.
This multiplies each number in a vector of strings,\nif a string could not be parsed the operation returns Err
:
let nums = vec!["5", "10", "1", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert_eq!(total, Ok(100));\nlet nums = vec!["5", "10", "one", "2"];\nlet total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();\nassert!(total.is_err());
map_err(|err| HandlerError::from(err).with_status(status_code))
.hyper::Response
[StatusCode::OK]
by default.[StatusCode::OK]
by default.[StatusCode::OK]
by default.[StatusCode::OK]
by default.