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