pub struct ArcRwLockStream(/* private fields */);Implementations§
Source§impl ArcRwLockStream
impl ArcRwLockStream
pub fn from(arc_rw_lock_stream: ArcRwLock<TcpStream>) -> Self
pub fn from_stream(stream: TcpStream) -> Self
pub async fn get_read_lock(&self) -> RwLockReadGuardTcpStream<'_>
pub async fn get_write_lock(&self) -> RwLockWriteGuardTcpStream<'_>
Sourcepub async fn send(&self, data: &ResponseData) -> ResponseResult
pub async fn send(&self, data: &ResponseData) -> ResponseResult
Sourcepub async fn send_body(
&self,
body: &ResponseBody,
is_websocket: bool,
) -> ResponseResult
pub async fn send_body( &self, body: &ResponseBody, is_websocket: bool, ) -> ResponseResult
Sourcepub async fn flush(&self) -> ResponseResult
pub async fn flush(&self) -> ResponseResult
Flush the TCP stream.
- Returns: A
ResponseResultindicating success or failure.
Sourcepub async fn close(&self) -> ResponseResult
pub async fn close(&self) -> ResponseResult
Closes the stream after sending the response.
This function is responsible for:
- Building the response using the
build()method. - Setting the response using the
set_response()method. - Shutting down the write half of the TCP stream to indicate no more data will be sent.
§Returns
ResponseResult: The result of the operation, indicating whether the closure was successful or if an error occurred.
Trait Implementations§
Source§impl Clone for ArcRwLockStream
impl Clone for ArcRwLockStream
Source§fn clone(&self) -> ArcRwLockStream
fn clone(&self) -> ArcRwLockStream
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for ArcRwLockStream
impl !RefUnwindSafe for ArcRwLockStream
impl Send for ArcRwLockStream
impl Sync for ArcRwLockStream
impl Unpin for ArcRwLockStream
impl !UnwindSafe for ArcRwLockStream
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