pub struct ResponseBuilder { /* private fields */ }Expand description
A response builder with pre-allocated buffer for efficient response creation.
This builder allocates a buffer upfront and allows building the response body incrementally without reallocations.
§Example
ⓘ
use armature_core::response_buffer::ResponseBuilder;
let response = ResponseBuilder::new()
.status(200)
.header("Content-Type", "application/json")
.body_json(&data)?
.build();Implementations§
Source§impl ResponseBuilder
impl ResponseBuilder
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with custom buffer capacity.
Sourcepub fn content_type(self, value: impl Into<String>) -> Self
pub fn content_type(self, value: impl Into<String>) -> Self
Set Content-Type header.
Sourcepub fn body_mut(&mut self) -> &mut ResponseBuffer ⓘ
pub fn body_mut(&mut self) -> &mut ResponseBuffer ⓘ
Get mutable reference to body buffer for direct writes.
Sourcepub fn build(self) -> HttpResponse
pub fn build(self) -> HttpResponse
Build the final HttpResponse.
Trait Implementations§
Source§impl Debug for ResponseBuilder
impl Debug for ResponseBuilder
Auto Trait Implementations§
impl Freeze for ResponseBuilder
impl RefUnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Sync for ResponseBuilder
impl Unpin for ResponseBuilder
impl UnwindSafe for ResponseBuilder
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> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging