pub struct Yield {
pub request_id: u64,
pub options: Value,
pub args: Value,
pub kwargs: Value,
}
Expand description
Yield - wamp-proto
Represents an Yield message in the WAMP protocol.
Examples
use wamp_core::messages::Yield;
use wamp_core::r#yield;
use serde_json::{json, Value};
let r#yield = Yield {
request_id: 2,
options: json!({}),
args: serde_json::Value::Null,
kwargs: serde_json::Value::Null
};
let mut r#yield2 = r#yield!{1, json!({})};
assert_ne!(r#yield, r#yield2);
r#yield2.request_id = 2;
assert_eq!(r#yield, r#yield2);
Serializer
Serde Serialize trait implementation for Yield.
use wamp_core::messages::Yield;
use serde_json::{json, to_string};
let r#yield = Yield {
request_id: 2,
options: json!({}),
args: json!([1, 2, 3]),
kwargs: json!({"key": "value"})
};
let r#yield2_string = r#"[70,2,{},[1,2,3],{"key":"value"}]"#;
let r#yield_string = to_string(&r#yield).unwrap();
assert_eq!(r#yield_string, r#yield2_string);
Deserializer
Serde Deserialize trait implementation for Yield.
use wamp_core::messages::Yield;
use serde_json::{json, from_str};
let r#yield = Yield {
request_id: 2,
options: json!({}),
args: json!([1, 2, 3]),
kwargs: json!({"key": "value"})
};
let r#yield2_string = r#"[70,2,{},[1,2,3],{"key":"value"}]"#;
let r#yield2 = from_str::<Yield>(r#yield2_string).unwrap();
assert_eq!(r#yield, r#yield2);
Fields§
§request_id: u64
§options: Value
§args: Value
§kwargs: Value
Trait Implementations§
source§impl<'de> Deserialize<'de> for Yield
impl<'de> Deserialize<'de> for Yield
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 PartialEq for Yield
impl PartialEq for Yield
source§impl WampMessage for Yield
impl WampMessage for Yield
impl Eq for Yield
impl StructuralEq for Yield
impl StructuralPartialEq for Yield
Auto Trait Implementations§
impl RefUnwindSafe for Yield
impl Send for Yield
impl Sync for Yield
impl Unpin for Yield
impl UnwindSafe for Yield
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