pub trait CallTrait {
fn reply_struct(&mut self, reply: Reply) -> Result<()>;
fn set_continues(&mut self, cont: bool);
fn to_upgraded(&mut self);
fn is_oneway(&self) -> bool;
fn wants_more(&self) -> bool;
fn get_request(&self) -> Option<&Request<'_>>;
fn reply_method_not_found(&mut self, method_name: String) -> Result<()> { ... }
fn reply_method_not_implemented(&mut self, method_name: String) -> Result<()> { ... }
fn reply_invalid_parameter(&mut self, parameter_name: String) -> Result<()> { ... }
}
Expand description
CallTrait provides convenience methods for the Call
struct, which is passed as
the first argument to the interface methods.
Examples
For an invalid parameter:
fn test_method(&self, call: &mut Call_TestMethod, testparam: i64) -> varlink::Result<()> {
match testparam {
0 ... 100 => {},
_ => {
return call.reply_invalid_parameter("testparam".into());
}
}
/* ... */
Ok(())
}
For not yet implemented methods:
fn test_method_not_implemented(&self,
call: &mut Call_TestMethodNotImplemented) -> varlink::Result<()> {
return call.reply_method_not_implemented("TestMethodNotImplemented".into());
}
Required Methods§
sourcefn reply_struct(&mut self, reply: Reply) -> Result<()>
fn reply_struct(&mut self, reply: Reply) -> Result<()>
Don’t use this directly. Rather use the standard reply()
method.
sourcefn set_continues(&mut self, cont: bool)
fn set_continues(&mut self, cont: bool)
Set this to true
to indicate, that more replies are following.
Examples
fn test_method(&self, call: &mut Call_TestMethod) -> varlink::Result<()> {
call.set_continues(true);
call.reply( /* more args*/ )?;
call.reply( /* more args*/ )?;
call.reply( /* more args*/ )?;
call.set_continues(false);
return call.reply( /* more args*/ );
}
fn to_upgraded(&mut self)
sourcefn wants_more(&self) -> bool
fn wants_more(&self) -> bool
True, if this request accepts more than one reply.
fn get_request(&self) -> Option<&Request<'_>>
Provided Methods§
sourcefn reply_method_not_found(&mut self, method_name: String) -> Result<()>
fn reply_method_not_found(&mut self, method_name: String) -> Result<()>
reply with the standard varlink org.varlink.service.MethodNotFound
error
sourcefn reply_method_not_implemented(&mut self, method_name: String) -> Result<()>
fn reply_method_not_implemented(&mut self, method_name: String) -> Result<()>
reply with the standard varlink org.varlink.service.MethodNotImplemented
error
sourcefn reply_invalid_parameter(&mut self, parameter_name: String) -> Result<()>
fn reply_invalid_parameter(&mut self, parameter_name: String) -> Result<()>
reply with the standard varlink org.varlink.service.InvalidParameter
error