pub struct CustomResponse {
pub http_code: HttpCode,
pub name: String,
pub data: String,
pub description: String,
}Expand description
A customizable HTTP response for Actix Web applications.
CustomResponse provides a flexible way to create HTTP responses with
custom status codes, data payloads, and metadata. It implements Actix’s
Responder trait, making it directly returnable from route handlers.
Fields§
§http_code: HttpCodeThe HTTP status code and associated metadata
name: StringName identifier for the response (useful for logging and debugging)
data: StringThe response payload (typically JSON or XML formatted as a string)
description: StringHuman-readable description of the response
Implementations§
Trait Implementations§
Source§impl Clone for CustomResponse
impl Clone for CustomResponse
Source§fn clone(&self) -> CustomResponse
fn clone(&self) -> CustomResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CustomResponse
impl Debug for CustomResponse
Source§impl Responder for CustomResponse
Implements Actix’s Responder trait for CustomResponse.
impl Responder for CustomResponse
Implements Actix’s Responder trait for CustomResponse.
This allows CustomResponse instances to be returned directly from route handlers, with automatic conversion to HttpResponse.
type Body = BoxBody
Source§fn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>
fn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>
Convert self to
HttpResponse.Auto Trait Implementations§
impl Freeze for CustomResponse
impl RefUnwindSafe for CustomResponse
impl Send for CustomResponse
impl Sync for CustomResponse
impl Unpin for CustomResponse
impl UnwindSafe for CustomResponse
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