Struct wamp_core::messages::subscribed::Subscribed
source · pub struct Subscribed {
pub request_id: u64,
pub subscription: u64,
}
Expand description
Subscribed - wamp-proto
Represents an subscribed message in the WAMP protocol.
Examples
use wamp_core::messages::Subscribed;
use wamp_core::subscribed;
use serde_json::json;
let subscribed_message = Subscribed {
request_id: 1,
subscription: 2
};
Serializer
Implements serde Serialize trait for subscribed
use wamp_core::messages::Subscribed;
use serde_json::{json, to_string};
// Create an subscribed message
let subscribed = Subscribed {
request_id: 1,
subscription: 2
};
// Establish raw json data string
let data = r#"[33,1,2]"#;
// Here we convert it from an `Subscribed` frame, to a string representation.
let subscribed = to_string(&subscribed).unwrap();
// Confirm that our Subscribed frame strings are equal to each other
assert_eq!(subscribed, data);
Deserializer
Implements serde Deserialize trait for Subscribed
use wamp_core::messages::Subscribed;
use serde_json::from_str;
// Here is our raw json data string
let data = r#"[33,1,2]"#;
// Here we convert it to an `subscribed` frame
let subscribed = from_str::<Subscribed>(data).unwrap();
// Confirm that our request_id and subscription deserialized
assert_eq!(subscribed.request_id, 1);
assert_eq!(subscribed.subscription, 2);
Fields§
§request_id: u64
§subscription: u64
Trait Implementations§
source§impl Clone for Subscribed
impl Clone for Subscribed
source§fn clone(&self) -> Subscribed
fn clone(&self) -> Subscribed
Returns a copy 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 moresource§impl Debug for Subscribed
impl Debug for Subscribed
source§impl<'de> Deserialize<'de> for Subscribed
impl<'de> Deserialize<'de> for Subscribed
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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<Messages> for Subscribed
impl From<Messages> for Subscribed
source§fn from(v: Messages) -> Subscribed
fn from(v: Messages) -> Subscribed
Converts to this type from the input type.
source§impl From<Subscribed> for Messages
impl From<Subscribed> for Messages
source§fn from(v: Subscribed) -> Messages
fn from(v: Subscribed) -> Messages
Converts to this type from the input type.
source§impl PartialEq for Subscribed
impl PartialEq for Subscribed
source§fn eq(&self, other: &Subscribed) -> bool
fn eq(&self, other: &Subscribed) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for Subscribed
impl Serialize for Subscribed
source§impl TryFrom<Subscribed> for Message
impl TryFrom<Subscribed> for Message
source§impl WampMessage for Subscribed
impl WampMessage for Subscribed
impl Eq for Subscribed
impl StructuralEq for Subscribed
impl StructuralPartialEq for Subscribed
Auto Trait Implementations§
impl RefUnwindSafe for Subscribed
impl Send for Subscribed
impl Sync for Subscribed
impl Unpin for Subscribed
impl UnwindSafe for Subscribed
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