Enum WsEvent

Source
pub enum WsEvent {
    Open,
    Error,
    Closing,
    Closed(CloseEvent),
    WsErr(WsErr),
}

Variants§

§

Open

The connection is now Open and ready for use.

§

Error

An error happened on the connection. For more information about when this event occurs, see the HTML Living Standard. Since the browser is not allowed to convey any information to the client code as to why an error happened (for security reasons), as described in the HTML specification, there usually is no extra information available. That’s why this event has no data attached to it.

§

Closing

The connection has started closing, but is not closed yet. You shouldn’t try to send messages over it anymore. Trying to do so will result in an error.

§

Closed(CloseEvent)

The connection was closed. The enclosed CloseEvent has some extra information.

§

WsErr(WsErr)

An error happened, not on the connection, but inside ws_stream_wasm. This currently happens when an incoming message can not be converted to Rust types, eg. a String message with invalid encoding.

Implementations§

Source§

impl WsEvent

Source

pub fn is_open(&self) -> bool

Predicate indicating whether this is a WsEvent::Open event. Can be used as a filter for the event stream obtained with pharos::Observable::observe on WsMeta.

Source

pub fn is_err(&self) -> bool

Predicate indicating whether this is a WsEvent::Error event. Can be used as a filter for the event stream obtained with pharos::Observable::observe on WsMeta.

Source

pub fn is_closing(&self) -> bool

Predicate indicating whether this is a WsEvent::Closing event. Can be used as a filter for the event stream obtained with pharos::Observable::observe on WsMeta.

Source

pub fn is_closed(&self) -> bool

Predicate indicating whether this is a WsEvent::Closed event. Can be used as a filter for the event stream obtained with pharos::Observable::observe on WsMeta.

Source

pub fn is_ws_err(&self) -> bool

Predicate indicating whether this is a WsEvent::WsErr event. Can be used as a filter for the event stream obtained with pharos::Observable::observe on WsMeta.

Trait Implementations§

Source§

impl Clone for WsEvent

Source§

fn clone(&self) -> WsEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WsEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Observable<WsEvent> for WsMeta

Source§

type Error = PharErr

The error type that is returned if observing is not possible. Read more
Source§

fn observe( &mut self, options: ObserveConfig<WsEvent>, ) -> Observe<'_, WsEvent, Self::Error>

Add an observer to the observable. Options allow chosing the channel type and to filter events with a predicate.
Source§

impl PartialEq for WsEvent

Source§

fn eq(&self, other: &WsEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for WsEvent

Source§

impl StructuralPartialEq for WsEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.