[−][src]Enum ws_stream_wasm::WsEvent
Events related to the WebSocket. You can filter like:
use { ws_stream_wasm :: * , pharos :: * , wasm_bindgen :: UnwrapThrowExt , wasm_bindgen_futures :: futures_0_3::spawn_local , futures :: stream::StreamExt , }; let program = async { let (mut ws, _wsio) = WsStream::connect( "127.0.0.1:3012", None ).await .expect_throw( "assume the connection succeeds" ); // The Filter type comes from the pharos crate. // let mut evts = ws.observe( Filter::Pointer( WsEvent::is_closed ).into() ); ws.close().await; // Note we will only get the closed event here, the WsEvent::Closing has been filtered out. // assert!( evts.next().await.unwrap_throw().is_closed () ); }; spawn_local( program );
Variants
The connection is now Open
An error happened on the connection. For more information about when this event occurs, see the HTML Living Standard.
The connection has started closing, but is not closed yet.
Closed(CloseEvent)
The connection was closed. This enclosed CloseEvent has some extra information.
Methods
impl WsEvent
[src]
pub fn is_open(&self) -> bool
[src]
Predicate indicating whether this is a WsEvent::Open event. Can be used as a filter for the
event stream obtained with [WsStream::observe
].
pub fn is_err(&self) -> bool
[src]
Predicate indicating whether this is a WsEvent::Error event. Can be used as a filter for the
event stream obtained with [WsStream::observe
].
pub fn is_closing(&self) -> bool
[src]
Predicate indicating whether this is a WsEvent::Closing event. Can be used as a filter for the
event stream obtained with [WsStream::observe
].
pub fn is_closed(&self) -> bool
[src]
Predicate indicating whether this is a WsEvent::Closed event. Can be used as a filter for the
event stream obtained with [WsStream::observe
].
Trait Implementations
impl Eq for WsEvent
[src]
impl Clone for WsEvent
[src]
impl PartialEq<WsEvent> for WsEvent
[src]
impl Debug for WsEvent
[src]
impl Observable<WsEvent> for WsStream
[src]
Auto Trait Implementations
impl Send for WsEvent
impl Unpin for WsEvent
impl Sync for WsEvent
impl UnwindSafe for WsEvent
impl RefUnwindSafe for WsEvent
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,