[][src]Trait sunrise_libuser::example::IExample2

pub trait IExample2 {
    fn function(&mut self, manager: WorkQueue<'static>) -> Result<(), Error>;
fn function2(
        &mut self,
        manager: WorkQueue<'static>,
        val1: u32,
        val2: u32
    ) -> Result<(bool, bool), Error>; fn dispatch<'a>(
        &'a mut self,
        manager: WorkQueue<'static>,
        cmdid: u32,
        buf: &'a mut [u8]
    ) -> FutureObj<Result<(), Error>> { ... } }

Let's make things a bit more interesting by adding a function or two.

Required methods

fn function(&mut self, manager: WorkQueue<'static>) -> 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(
    &mut self,
    manager: WorkQueue<'static>,
    val1: u32,
    val2: u32
) -> 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.

Loading content...

Provided methods

fn dispatch<'a>(
    &'a mut self,
    manager: WorkQueue<'static>,
    cmdid: u32,
    buf: &'a mut [u8]
) -> FutureObj<Result<(), Error>>

Handle an incoming IPC request.

Loading content...

Implementors

Loading content...