pub struct Stream { /* private fields */ }Implementations§
Source§impl Stream
impl Stream
Sourcepub fn is_keep_alive(&self, keep_alive: bool) -> bool
pub fn is_keep_alive(&self, keep_alive: bool) -> bool
Checks if the connection should be kept alive.
This method evaluates whether the connection should remain open based on the closed state and the keep_alive parameter.
§Arguments
bool- Whether keep-alive is enabled for the request.
§Returns
bool- True if the connection should be kept alive, otherwise false.
Sourcepub unsafe fn free(&mut self)
pub unsafe fn free(&mut self)
Free the context.
§Safety
- The address is guaranteed to be a valid
Selfinstance that was previously converted from a reference and is managed by the runtime.
Sourcepub async fn try_get_http_request(&mut self) -> Result<Request, RequestError>
pub async fn try_get_http_request(&mut self) -> Result<Request, RequestError>
Parses an HTTP request from a TCP stream.
Wraps the stream in a buffered reader and delegates to http_from_reader.
If the timeout is DEFAULT_LOW_SECURITY_READ_TIMEOUT_MS, no timeout is applied.
§Returns
Result<Request, RequestError>- The parsed request or an error.
Sourcepub async fn try_get_websocket_request(
&mut self,
) -> Result<RequestBody, RequestError>
pub async fn try_get_websocket_request( &mut self, ) -> Result<RequestBody, RequestError>
Parses a WebSocket request from a TCP stream.
Wraps the stream in a buffered reader and delegates to ws_from_reader.
If the timeout is DEFAULT_LOW_SECURITY_READ_TIMEOUT_MS, no timeout is applied.
§Returns
Result<Request, RequestError>: The parsed WebSocket request or an error.
Sourcepub async fn try_send<D>(&mut self, data: D) -> Result<(), ResponseError>
pub async fn try_send<D>(&mut self, data: D) -> Result<(), ResponseError>
Sourcepub async fn try_send_list<I, D>(
&mut self,
data_iter: I,
) -> Result<(), ResponseError>
pub async fn try_send_list<I, D>( &mut self, data_iter: I, ) -> Result<(), ResponseError>
Source§impl Stream
impl Stream
pub fn get_stream(&self) -> &TcpStream
pub fn get_request_config(&self) -> &RequestConfig
pub fn get_closed(&self) -> bool
pub fn set_closed(&mut self, val: bool) -> &mut Self
Trait Implementations§
Source§impl From<&Stream> for usize
Implementation of From trait for converting &Stream into usize address.
impl From<&Stream> for usize
Implementation of From trait for converting &Stream into usize address.
Source§impl From<&mut Stream> for usize
Implementation of From trait for converting &mut Stream into usize address.
impl From<&mut Stream> for usize
Implementation of From trait for converting &mut Stream into usize address.
Source§impl From<usize> for &'static Stream
Implementation of From trait for converting usize address into &Stream.
impl From<usize> for &'static Stream
Implementation of From trait for converting usize address into &Stream.
Source§fn from(address: usize) -> &'static Stream
fn from(address: usize) -> &'static Stream
Converts a memory address into a reference to Stream.
§Arguments
usize- The memory address of theStreaminstance.
§Returns
&'static Stream- A reference to theStreamat the given address.
§Safety
- The address is guaranteed to be a valid
Streaminstance that was previously converted from a reference and is managed by the runtime.
Source§impl<'a> From<usize> for &'a mut Stream
Implementation of From trait for converting usize address into &mut Stream.
impl<'a> From<usize> for &'a mut Stream
Implementation of From trait for converting usize address into &mut Stream.
Source§fn from(address: usize) -> &'a mut Stream
fn from(address: usize) -> &'a mut Stream
Converts a memory address into a mutable reference to Stream.
§Arguments
usize- The memory address of theStreaminstance.
§Returns
&mut Stream- A mutable reference to theStreamat the given address.
§Safety
- The address is guaranteed to be a valid
Streaminstance that was previously converted from a reference and is managed by the runtime.