pub enum Messages {
Show 25 variants Abort(Abort), Authenticate(Authenticate), Call(Call), Cancel(Cancel), Challenge(Challenge), Error(WampError), Event(Event), Goodbye(Goodbye), Hello(Hello), Interrupt(Interrupt), Invocation(Invocation), Publish(Publish), Published(Published), Register(Register), Registered(Registered), Result(WampResult), Subscribe(Subscribe), Subscribed(Subscribed), Unregister(Unregister), Unregistered(Unregistered), Unsubscribe(Unsubscribe), Unsubscribed(Unsubscribed), Welcome(Welcome), Yield(Yield), Extension(Vec<Value>),
}
Expand description

Messages Enum

This represents each of the messages described in the WAMP protocol.

This includes its own deserializer (you should serialize using the inner struct always).

It also implements From<*n> for Messages where n = each WAMP message.

Examples

use wamp_core::messages::{Call, Messages};
use wamp_core::call;
use serde_json::{Value, json, from_str};

let message = Messages::from(call!("topic"));

// Which is the same as this:
let mut message2 = Messages::Call(Call {
    request_id: 1,
    options: json!({}),
    procedure: "topic".to_string(),
    args: Value::Null,
    kwargs: Value::Null
});
assert_eq!(message, message2);

// Lets make a raw string to pass to the deserializer (this is a Call message)
let data = r#"[48,1,{},"topic"]"#;

// Deserialize the raw string
let message3 = from_str::<Messages>(data).unwrap();

assert_eq!(message2, message3);

Variants§

§

Abort(Abort)

§

Authenticate(Authenticate)

§

Call(Call)

§

Cancel(Cancel)

§

Challenge(Challenge)

§

Error(WampError)

§

Event(Event)

§

Goodbye(Goodbye)

§

Hello(Hello)

§

Interrupt(Interrupt)

§

Invocation(Invocation)

§

Publish(Publish)

§

Published(Published)

§

Register(Register)

§

Registered(Registered)

§

Result(WampResult)

§

Subscribe(Subscribe)

§

Subscribed(Subscribed)

§

Unregister(Unregister)

§

Unregistered(Unregistered)

§

Unsubscribe(Unsubscribe)

§

Unsubscribed(Unsubscribed)

§

Welcome(Welcome)

§

Yield(Yield)

§

Extension(Vec<Value>)

Implementations§

source§

impl Messages

source

pub fn id(&self) -> Option<u64>

Get Message ID

Get the message ID of a WAMP message. This uses the static u64 for any known WAMP messages.

For Extension messages, it attempts to get the ID and returns None otherwise.

Examples
use wamp_core::call;
use wamp_core::messages::Messages;

let message = Messages::from(call!("topic"));

let message_id = message.id();

assert_eq!(message_id, Some(48));

Trait Implementations§

source§

impl Clone for Messages

source§

fn clone(&self) -> Messages

Returns a copy 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 Messages

source§

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

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

impl<'de> Deserialize<'de> for Messages

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<Abort> for Messages

source§

fn from(v: Abort) -> Messages

Converts to this type from the input type.
source§

impl From<Authenticate> for Messages

source§

fn from(v: Authenticate) -> Messages

Converts to this type from the input type.
source§

impl From<Call> for Messages

source§

fn from(v: Call) -> Messages

Converts to this type from the input type.
source§

impl From<Cancel> for Messages

source§

fn from(v: Cancel) -> Messages

Converts to this type from the input type.
source§

impl From<Challenge> for Messages

source§

fn from(v: Challenge) -> Messages

Converts to this type from the input type.
source§

impl From<Event> for Messages

source§

fn from(v: Event) -> Messages

Converts to this type from the input type.
source§

impl From<Goodbye> for Messages

source§

fn from(v: Goodbye) -> Messages

Converts to this type from the input type.
source§

impl From<Hello> for Messages

source§

fn from(v: Hello) -> Messages

Converts to this type from the input type.
source§

impl From<Interrupt> for Messages

source§

fn from(v: Interrupt) -> Messages

Converts to this type from the input type.
source§

impl From<Invocation> for Messages

source§

fn from(v: Invocation) -> Messages

Converts to this type from the input type.
source§

impl From<Messages> for Abort

source§

fn from(v: Messages) -> Abort

Converts to this type from the input type.
source§

impl From<Messages> for Authenticate

source§

fn from(v: Messages) -> Authenticate

Converts to this type from the input type.
source§

impl From<Messages> for Call

source§

fn from(v: Messages) -> Call

Converts to this type from the input type.
source§

impl From<Messages> for Cancel

source§

fn from(v: Messages) -> Cancel

Converts to this type from the input type.
source§

impl From<Messages> for Challenge

source§

fn from(v: Messages) -> Challenge

Converts to this type from the input type.
source§

impl From<Messages> for Event

source§

fn from(v: Messages) -> Event

Converts to this type from the input type.
source§

impl From<Messages> for Goodbye

source§

fn from(v: Messages) -> Goodbye

Converts to this type from the input type.
source§

impl From<Messages> for Hello

source§

fn from(v: Messages) -> Hello

Converts to this type from the input type.
source§

impl From<Messages> for Interrupt

source§

fn from(v: Messages) -> Interrupt

Converts to this type from the input type.
source§

impl From<Messages> for Invocation

source§

fn from(v: Messages) -> Invocation

Converts to this type from the input type.
source§

impl From<Messages> for Publish

source§

fn from(v: Messages) -> Publish

Converts to this type from the input type.
source§

impl From<Messages> for Published

source§

fn from(v: Messages) -> Published

Converts to this type from the input type.
source§

impl From<Messages> for Register

source§

fn from(v: Messages) -> Register

Converts to this type from the input type.
source§

impl From<Messages> for Registered

source§

fn from(v: Messages) -> Registered

Converts to this type from the input type.
source§

impl From<Messages> for Subscribe

source§

fn from(v: Messages) -> Subscribe

Converts to this type from the input type.
source§

impl From<Messages> for Subscribed

source§

fn from(v: Messages) -> Subscribed

Converts to this type from the input type.
source§

impl From<Messages> for Unregister

source§

fn from(v: Messages) -> Unregister

Converts to this type from the input type.
source§

impl From<Messages> for Unregistered

source§

fn from(v: Messages) -> Unregistered

Converts to this type from the input type.
source§

impl From<Messages> for Unsubscribe

source§

fn from(v: Messages) -> Unsubscribe

Converts to this type from the input type.
source§

impl From<Messages> for Unsubscribed

source§

fn from(v: Messages) -> Unsubscribed

Converts to this type from the input type.
source§

impl From<Messages> for Welcome

source§

fn from(v: Messages) -> Welcome

Converts to this type from the input type.
source§

impl From<Messages> for Yield

source§

fn from(v: Messages) -> Yield

Converts to this type from the input type.
source§

impl From<Publish> for Messages

source§

fn from(v: Publish) -> Messages

Converts to this type from the input type.
source§

impl From<Published> for Messages

source§

fn from(v: Published) -> Messages

Converts to this type from the input type.
source§

impl From<Register> for Messages

source§

fn from(v: Register) -> Messages

Converts to this type from the input type.
source§

impl From<Registered> for Messages

source§

fn from(v: Registered) -> Messages

Converts to this type from the input type.
source§

impl From<Subscribe> for Messages

source§

fn from(v: Subscribe) -> Messages

Converts to this type from the input type.
source§

impl From<Subscribed> for Messages

source§

fn from(v: Subscribed) -> Messages

Converts to this type from the input type.
source§

impl From<Unregister> for Messages

source§

fn from(v: Unregister) -> Messages

Converts to this type from the input type.
source§

impl From<Unregistered> for Messages

source§

fn from(v: Unregistered) -> Messages

Converts to this type from the input type.
source§

impl From<Unsubscribe> for Messages

source§

fn from(v: Unsubscribe) -> Messages

Converts to this type from the input type.
source§

impl From<Unsubscribed> for Messages

source§

fn from(v: Unsubscribed) -> Messages

Converts to this type from the input type.
source§

impl From<WampError> for Messages

source§

fn from(v: WampError) -> Self

Converts to this type from the input type.
source§

impl From<WampResult> for Messages

source§

fn from(v: WampResult) -> Self

Converts to this type from the input type.
source§

impl From<Welcome> for Messages

source§

fn from(v: Welcome) -> Messages

Converts to this type from the input type.
source§

impl From<Yield> for Messages

source§

fn from(v: Yield) -> Messages

Converts to this type from the input type.
source§

impl PartialEq for Messages

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<Message> for Messages

§

type Error = Error

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

fn try_from(value: Message) -> Result<Self, Error>

Performs the conversion.
source§

impl TryFrom<Messages> for WampError

§

type Error = Error

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

fn try_from(v: Messages) -> Result<WampError, Self::Error>

Performs the conversion.
source§

impl TryFrom<Messages> for WampResult

§

type Error = Error

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

fn try_from(v: Messages) -> Result<WampResult, Self::Error>

Performs the conversion.
source§

impl Eq for Messages

source§

impl StructuralEq for Messages

source§

impl StructuralPartialEq for Messages

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,