pub struct ArgumentConfiguration { /* private fields */ }
Expand description
Lets the arguments to be configured for a method on the Hub
Implementations§
Source§impl ArgumentConfiguration
impl ArgumentConfiguration
Sourcepub fn argument<T: Serialize>(&mut self, value: T) -> &mut ArgumentConfiguration
pub fn argument<T: Serialize>(&mut self, value: T) -> &mut ArgumentConfiguration
Adds an argument to the method call configuration.
The arguments do not have names; the order of the arguments must match the order expected by the hub method.
§Arguments
value
- The value of the argument to add, which must implementSerialize
.
§Returns
&mut ArgumentConfiguration
- Returns a mutable reference to the updated argument configuration.
§Examples
let client = SignalRClient::connect("localhost", "test").await.unwrap();
let response: Result<bool, String> = client.invoke_with_args("PushEntity".to_string(), |c| {
c.argument(TestEntity {
text: "push1".to_string(),
number: 100,
});
}).await;
match response {
Ok(success) => {
if success {
info!("Entity pushed successfully");
} else {
error!("Failed to push entity");
}
}
Err(e) => {
error!("Failed to invoke method: {}", e);
}
}
Auto Trait Implementations§
impl Freeze for ArgumentConfiguration
impl RefUnwindSafe for ArgumentConfiguration
impl Send for ArgumentConfiguration
impl Sync for ArgumentConfiguration
impl Unpin for ArgumentConfiguration
impl UnwindSafe for ArgumentConfiguration
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