[−][src]Trait sunrise_libuser::example::IExample2Async
Let's make things a bit more interesting by adding a function or two.
Required methods
fn function<'a>(
&'a mut self,
work_queue: WorkQueue<'static>
) -> FutureObj<'a, Result<(), Error>>
&'a mut self,
work_queue: WorkQueue<'static>
) -> FutureObj<'a, Result<(), Error>>
This is the most simple kind of function: It takes no argument, and returns no value. It has cmdid 0, and is named "function".
Even though it returns no value, it may still return an error! Any command is allowed to return any error.
fn function2<'a>(
&'a mut self,
work_queue: WorkQueue<'static>,
val1: u32,
val2: u32
) -> FutureObj<'a, Result<(bool, bool), Error>>
&'a mut self,
work_queue: WorkQueue<'static>,
val1: u32,
val2: u32
) -> FutureObj<'a, Result<(bool, bool), Error>>
Here's a more complex function. This function takes two u32 as an argument, and return two bools.
Notice that cmdid don't need to be sequential, and don't need to start at 0. The only requirement is that they are unique within an interface.
Provided methods
fn dispatch<'a>(
&'a mut self,
work_queue: WorkQueue<'static>,
cmdid: u32,
buf: &'a mut [u8]
) -> FutureObj<Result<(), Error>>
&'a mut self,
work_queue: WorkQueue<'static>,
cmdid: u32,
buf: &'a mut [u8]
) -> FutureObj<Result<(), Error>>
Handle an incoming IPC request.