pub enum WireHandle {
WebSocket(WebSocketConnection),
WebRTC(WebRtcConnection),
}Expand description
WireHandle - Unified handle for Wire layer components
§Design Philosophy
- Uses enum dispatch instead of trait objects, achieving zero virtual call overhead
- Provides unified interface to access different Wire layer implementations
- Supports connection priority comparison (WebRTC > WebSocket)
Variants§
WebSocket(WebSocketConnection)
WebSocket connection handle
WebRTC(WebRtcConnection)
WebRTC connection handle
Implementations§
Source§impl WireHandle
impl WireHandle
Sourcepub fn connection_type(&self) -> &'static str
pub fn connection_type(&self) -> &'static str
Get connection type name
Sourcepub async fn connect(&self) -> NetworkResult<()>
pub async fn connect(&self) -> NetworkResult<()>
Establish connection
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected
Sourcepub async fn close(&self) -> NetworkResult<()>
pub async fn close(&self) -> NetworkResult<()>
Close connection
Sourcepub async fn get_lane(
&self,
payload_type: PayloadType,
) -> NetworkResult<DataLane>
pub async fn get_lane( &self, payload_type: PayloadType, ) -> NetworkResult<DataLane>
Get or create DataLane (with caching)
Sourcepub async fn create_lane(
&self,
payload_type: PayloadType,
) -> NetworkResult<DataLane>
pub async fn create_lane( &self, payload_type: PayloadType, ) -> NetworkResult<DataLane>
Create Lane (backward compatible)
Sourcepub fn as_webrtc(&self) -> Option<&WebRtcConnection>
pub fn as_webrtc(&self) -> Option<&WebRtcConnection>
Convert to WebRTC connection (if it is one)
Sourcepub fn as_websocket(&self) -> Option<&WebSocketConnection>
pub fn as_websocket(&self) -> Option<&WebSocketConnection>
Convert to WebSocket connection (if it is one)
Sourcepub async fn invalidate_lane(&self, payload_type: PayloadType)
pub async fn invalidate_lane(&self, payload_type: PayloadType)
Invalidate cached lane for WebRTC connections (no-op for WebSocket).
Trait Implementations§
Source§impl Clone for WireHandle
impl Clone for WireHandle
Source§fn clone(&self) -> WireHandle
fn clone(&self) -> WireHandle
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 WireHandle
impl !RefUnwindSafe for WireHandle
impl Send for WireHandle
impl Sync for WireHandle
impl Unpin for WireHandle
impl !UnwindSafe for WireHandle
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more