pub struct Call {
pub request_id: u64,
pub options: Value,
pub procedure: String,
pub args: Value,
pub kwargs: Value,
}
Expand description
Call - wamp-proto
Represents an Call message in the WAMP protocol.
Examples
use wamp_core::messages::Call;
use wamp_core::call;
use serde_json::{json, Value};
let call = Call {
request_id: 1,
options: json!({ }),
procedure: "procedure".to_string(),
args: Value::Null,
kwargs: Value::Null
};
let call2 = call!("procedure");
assert_eq!(call, call2);
Serializer
Serde Serialize trait implementation for Call.
use wamp_core::messages::Call;
use serde_json::{json, to_string};
let call = Call {
request_id: 7814135,
options: json!({}),
procedure: "com.myapp.user.new".to_string(),
args: json!(["johnny"]),
kwargs: json!({"firstname":"John","surname":"Doe"})
};
let call2_string = r#"[48,7814135,{},"com.myapp.user.new",["johnny"],{"firstname":"John","surname":"Doe"}]"#;
let call_string = to_string(&call).unwrap();
assert_eq!(call_string, call2_string);
Deserializer
Serde Deserialize trait implementation for Call.
use wamp_core::messages::Call;
use serde_json::{json, from_str};
let call = Call {
request_id: 7814135,
options: json!({}),
procedure: "com.myapp.user.new".to_string(),
args: json!(["johnny"]),
kwargs: json!({"firstname":"John","surname":"Doe"})
};
let call2_string = r#"[48,7814135,{},"com.myapp.user.new",["johnny"],{"firstname":"John","surname":"Doe"}]"#;
let call2 = from_str::<Call>(call2_string).unwrap();
assert_eq!(call, call2);
Fields§
§request_id: u64
§options: Value
§procedure: String
§args: Value
§kwargs: Value
Trait Implementations§
source§impl<'de> Deserialize<'de> for Call
impl<'de> Deserialize<'de> for Call
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 Call
impl PartialEq for Call
source§impl WampMessage for Call
impl WampMessage for Call
impl Eq for Call
impl StructuralEq for Call
impl StructuralPartialEq for Call
Auto Trait Implementations§
impl RefUnwindSafe for Call
impl Send for Call
impl Sync for Call
impl Unpin for Call
impl UnwindSafe for Call
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