pub struct ArcRwLockStream(/* private fields */);
Expand description
Thread-safe TCP stream wrapper.
Provides shared access to a TcpStream using Arc and RwLock.
§Fields
Arc<RwLock<TcpStream>>
- The protected TCP stream.
Implementations§
Source§impl ArcRwLockStream
impl ArcRwLockStream
Sourcepub fn from_stream(stream: TcpStream) -> Self
pub fn from_stream(stream: TcpStream) -> Self
Sourcepub async fn read(&self) -> RwLockReadGuardTcpStream<'_>
pub async fn read(&self) -> RwLockReadGuardTcpStream<'_>
Gets a read lock on the inner TcpStream.
Allows shared read access to the stream.
§Returns
RwLockReadGuardTcpStream
- The read guard for the stream.
Sourcepub async fn send(&self, data: &ResponseData) -> ResponseResult
pub async fn send(&self, data: &ResponseData) -> ResponseResult
Sourcepub async fn send_body_conditional(
&self,
body: &ResponseBody,
is_websocket: bool,
) -> ResponseResult
pub async fn send_body_conditional( &self, body: &ResponseBody, is_websocket: bool, ) -> ResponseResult
Sourcepub async fn send_body(&self, body: &ResponseBody) -> ResponseResult
pub async fn send_body(&self, body: &ResponseBody) -> ResponseResult
Sourcepub async fn send_ws_body(&self, body: &ResponseBody) -> ResponseResult
pub async fn send_ws_body(&self, body: &ResponseBody) -> ResponseResult
Trait Implementations§
Source§impl Clone for ArcRwLockStream
impl Clone for ArcRwLockStream
Source§fn clone(&self) -> ArcRwLockStream
fn clone(&self) -> ArcRwLockStream
Returns a duplicate 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