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) -> ArcRwLockStream
pub fn from_stream(stream: TcpStream) -> ArcRwLockStream
Sourcepub async fn read(&self) -> RwLockReadGuard<'_, TcpStream>
pub async fn read(&self) -> RwLockReadGuard<'_, TcpStream>
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_body_conditional(
&self,
body: &Vec<u8>,
is_websocket: bool,
) -> Result<(), ResponseError>
pub async fn send_body_conditional( &self, body: &Vec<u8>, is_websocket: bool, ) -> Result<(), ResponseError>
Sourcepub async fn send_ws_body(&self, body: &Vec<u8>) -> Result<(), ResponseError>
pub async fn send_ws_body(&self, body: &Vec<u8>) -> Result<(), ResponseError>
Sourcepub async fn flush(&self) -> &ArcRwLockStream
pub async fn flush(&self) -> &ArcRwLockStream
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