pub enum HttpSender<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> {
H1(Http1Sender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>),
H2(Http2Sender<'a, 'context>),
}Expand description
for sending http response to all supported protocols by the crate
Variants§
Trait Implementations§
Source§impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> HttpSenderTrait for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> HttpSenderTrait for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
Source§fn send_status_code(&mut self, http_status: StatusCode<'_>)
fn send_status_code(&mut self, http_status: StatusCode<'_>)
for setting http status code for response
Source§fn send_data_partial(&mut self, data: ResponseData<'_>)
fn send_data_partial(&mut self, data: ResponseData<'_>)
to send partial response
Source§async fn send_data_as_final_response(
&mut self,
data: ResponseData<'_>,
) -> Result<(), ()>
async fn send_data_as_final_response( &mut self, data: ResponseData<'_>, ) -> Result<(), ()>
send final response or full response
Source§fn set_header<K: Display, V: Display>(&mut self, key: K, value: V)
fn set_header<K: Display, V: Display>(&mut self, key: K, value: V)
for setting header key value to response holder
Source§fn set_header_ef<'h, K: Into<HeaderBytes<'h>>, V: Into<HeaderBytes<'h>>>(
&mut self,
key: K,
value: V,
)
fn set_header_ef<'h, K: Into<HeaderBytes<'h>>, V: Into<HeaderBytes<'h>>>( &mut self, key: K, value: V, )
for setting header with the highest efficiency
async fn send_json<JSON: Serialize>(&mut self, value: &JSON) -> Result<()>
Source§async fn send_str(&mut self, data: &'static str) -> Result<(), ()>
async fn send_str(&mut self, data: &'static str) -> Result<(), ()>
to send &str as response to client
Source§async fn send_file(&mut self, pc: FileRSender<'_>) -> SendingFileResults
async fn send_file(&mut self, pc: FileRSender<'_>) -> SendingFileResults
to send files as response to client ,
and it takes FileRSender
Source§async fn flush(&mut self) -> Result<(), ()>
async fn flush(&mut self) -> Result<(), ()>
for flushing response stream into route connection
Source§async fn write_custom_bytes(
&mut self,
bytes: &[u8],
) -> Result<(), WaterErrors<'_>>
async fn write_custom_bytes( &mut self, bytes: &[u8], ) -> Result<(), WaterErrors<'_>>
for writing custom bytes to the stream
fn extend_write_buffer(&mut self, bytes: &[u8])
Auto Trait Implementations§
impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> Freeze for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> !RefUnwindSafe for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> Send for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> Sync for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> Unpin for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
impl<'a, 'context, const HEADERS_COUNT: usize, const QUERY_COUNT: usize> !UnwindSafe for HttpSender<'a, 'context, HEADERS_COUNT, QUERY_COUNT>
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