pub struct ArcRwLockStream(/* private fields */);Implementations§
Source§impl ArcRwLockStream
impl ArcRwLockStream
Sourcepub fn from_stream(stream: TcpStream) -> ArcRwLockStream
pub fn from_stream(stream: TcpStream) -> ArcRwLockStream
Sourcepub async fn get_read_lock(&self) -> RwLockReadGuard<'_, TcpStream>
pub async fn get_read_lock(&self) -> RwLockReadGuard<'_, TcpStream>
Returns a reference to the inner TcpStream.
This method acquires a read lock on the underlying stream, allowing shared access to the TCP stream while preventing concurrent writes.
§Returns
Returns a read guard that provides shared access to the TCP stream
Sourcepub async fn get_write_lock(&self) -> RwLockWriteGuard<'_, TcpStream>
pub async fn get_write_lock(&self) -> RwLockWriteGuard<'_, TcpStream>
Returns a mutable reference to the inner TcpStream.
This method acquires a write lock on the underlying stream, allowing exclusive access for writing operations while preventing any concurrent access.
§Returns
Returns a write guard that provides exclusive access to the TCP stream
Sourcepub async fn flush(&self) -> Result<(), Error>
pub async fn flush(&self) -> Result<(), Error>
Flush the TCP stream.
- Returns: A
ResponseResultindicating success or failure.
Sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
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