[−][src]Trait varlink::CallTrait
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
fn reply_struct(&mut self, reply: Reply) -> Result<()>
Don't use this directly. Rather use the standard reply()
method.
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)
fn is_oneway(&self) -> bool
True, if this request does not want a reply.
fn wants_more(&self) -> bool
True, if this request accepts more than one reply.
fn get_request(&self) -> Option<&Request>
Provided methods
fn reply_method_not_found(&mut self, method_name: String) -> Result<()>
reply with the standard varlink org.varlink.service.MethodNotFound
error
fn reply_method_not_implemented(&mut self, method_name: String) -> Result<()>
reply with the standard varlink org.varlink.service.MethodNotImplemented
error
fn reply_invalid_parameter(&mut self, parameter_name: String) -> Result<()>
reply with the standard varlink org.varlink.service.InvalidParameter
error
Implementors
impl<'a> CallTrait for Call<'a>
[src]
fn reply_struct(&mut self, reply: Reply) -> Result<()>
[src]
fn set_continues(&mut self, cont: bool)
[src]
fn to_upgraded(&mut self)
[src]
fn is_oneway(&self) -> bool
[src]
True, if this request does not want a reply.
fn wants_more(&self) -> bool
[src]
True, if this request accepts more than one reply.