Struct wamp_core::messages::result::WampResult
source · pub struct WampResult {
pub request_id: u64,
pub details: Value,
pub args: Value,
pub kwargs: Value,
}
Expand description
Result - wamp-proto
Represents an Result message in the WAMP protocol.
Examples
use wamp_core::messages::WampResult;
use wamp_core::result;
use serde_json::{json, Value};
let mut result = WampResult {
request_id: 1,
details: json!({}),
args: Value::Null,
kwargs: Value::Null
};
let result2 = result!(2);
assert_ne!(result, result2);
result.request_id = 2;
assert_eq!(result, result2);
Serializer
Serde Serialize trait implementation for Result.
use wamp_core::messages::WampResult;
use serde_json::{json, to_string};
let result = WampResult {
request_id: 1,
details: json!({}),
args: json!([1, 2, 3]),
kwargs: json!({"key": "value"})
};
let result2_string = r#"[50,1,{},[1,2,3],{"key":"value"}]"#;
let result_string = to_string(&result).unwrap();
assert_eq!(result_string, result2_string);
Deserializer
Serde Deserialize trait implementation for Result.
use wamp_core::messages::WampResult;
use serde_json::{json, from_str};
let result = WampResult {
request_id: 1,
details: json!({}),
args: json!([1, 2, 3]),
kwargs: json!({"key": "value"})
};
let result2_string = r#"[50,1,{},[1,2,3],{"key":"value"}]"#;
let result2 = from_str::<WampResult>(result2_string).unwrap();
assert_eq!(result, result2);
Fields§
§request_id: u64
§details: Value
§args: Value
§kwargs: Value
Trait Implementations§
source§impl Clone for WampResult
impl Clone for WampResult
source§fn clone(&self) -> WampResult
fn clone(&self) -> WampResult
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 WampResult
impl Debug for WampResult
source§impl<'de> Deserialize<'de> for WampResult
impl<'de> Deserialize<'de> for WampResult
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<WampResult> for Messages
impl From<WampResult> for Messages
source§fn from(v: WampResult) -> Self
fn from(v: WampResult) -> Self
Converts to this type from the input type.
source§impl PartialEq for WampResult
impl PartialEq for WampResult
source§fn eq(&self, other: &WampResult) -> bool
fn eq(&self, other: &WampResult) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for WampResult
impl Serialize for WampResult
source§impl TryFrom<Messages> for WampResult
impl TryFrom<Messages> for WampResult
source§impl TryFrom<WampResult> for Message
impl TryFrom<WampResult> for Message
source§impl WampMessage for WampResult
impl WampMessage for WampResult
impl Eq for WampResult
impl StructuralEq for WampResult
impl StructuralPartialEq for WampResult
Auto Trait Implementations§
impl RefUnwindSafe for WampResult
impl Send for WampResult
impl Sync for WampResult
impl Unpin for WampResult
impl UnwindSafe for WampResult
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