pub struct Unsubscribe {
pub request_id: u64,
pub subscription: u64,
}
Expand description
§Unsubscribe - wamp-proto
Represents an Unsubscribe message in the WAMP protocol.
§Examples
use wamp_core::messages::Unsubscribe;
use wamp_core::unsubscribe;
use serde_json::json;
let unsubscribe_message = Unsubscribe {
request_id: 1,
subscription: 2
};
§Serializer
Implements serde Serialize trait for Unsubscribe
use wamp_core::messages::Unsubscribe;
use serde_json::{json, to_string};
// Create an unsubscribe message
let unsubscribe = Unsubscribe {
request_id: 1,
subscription: 2
};
// Establish raw json data string
let data = r#"[34,1,2]"#;
// Here we convert it from an `Unsubscribe` frame, to a string representation.
let unsubscribe = to_string(&unsubscribe).unwrap();
// Confirm that our unsubscribe frame strings are equal to each other
assert_eq!(unsubscribe, data);
§Deserializer
Implements serde Deserialize trait for Unsubscribe
use wamp_core::messages::Unsubscribe;
use serde_json::from_str;
// Here is our raw json data string
let data = r#"[34,1,2]"#;
// Here we convert it to an `Unsubscribe` frame
let unsubscribe = from_str::<Unsubscribe>(data).unwrap();
// Confirm that our request_id and subscription deserialized
assert_eq!(unsubscribe.request_id, 1);
assert_eq!(unsubscribe.subscription, 2);
Fields§
§request_id: u64
§subscription: u64
Trait Implementations§
Source§impl Clone for Unsubscribe
impl Clone for Unsubscribe
Source§fn clone(&self) -> Unsubscribe
fn clone(&self) -> Unsubscribe
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 moreSource§impl Debug for Unsubscribe
impl Debug for Unsubscribe
Source§impl<'de> Deserialize<'de> for Unsubscribe
impl<'de> Deserialize<'de> for Unsubscribe
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 Unsubscribe
impl From<Messages> for Unsubscribe
Source§fn from(v: Messages) -> Unsubscribe
fn from(v: Messages) -> Unsubscribe
Converts to this type from the input type.
Source§impl From<Unsubscribe> for Messages
impl From<Unsubscribe> for Messages
Source§fn from(v: Unsubscribe) -> Messages
fn from(v: Unsubscribe) -> Messages
Converts to this type from the input type.
Source§impl PartialEq for Unsubscribe
impl PartialEq for Unsubscribe
Source§impl Serialize for Unsubscribe
impl Serialize for Unsubscribe
Source§impl TryFrom<Unsubscribe> for Message
impl TryFrom<Unsubscribe> for Message
Source§impl WampMessage for Unsubscribe
impl WampMessage for Unsubscribe
impl Eq for Unsubscribe
impl StructuralPartialEq for Unsubscribe
Auto Trait Implementations§
impl Freeze for Unsubscribe
impl RefUnwindSafe for Unsubscribe
impl Send for Unsubscribe
impl Sync for Unsubscribe
impl Unpin for Unsubscribe
impl UnwindSafe for Unsubscribe
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