pub trait Callee {
    type Args;
    type JoinHandle;
    unsafe fn start_fiber(self, inner: NonNull<Fiber>) -> Self::JoinHandle;
    unsafe fn parse_args(args: VaList) -> Self::Args;
    unsafe fn invoke(a: Self::Args);
}
Expand description

Callee Types implementing this trait represent Fyber configurations relating to the kind of the fiber function. Currently only 2 kinds of functions are supported:

  • FiberFunc: a no arguments function that returns a value
  • FiberProc: a no arguments function that doesn’t return a value

TODO: add support for functions which take arguments?

Associated Types

Arguments for the trampoline function which will be passed through the va_list::VaList

JoinHandle type which will be returned from the Fyber::spawn function

Required methods

This function is called within Fyber::spawn to prepare the arguments for and invoke the [ffi::fiber_start] function.

Safety

This function is unsafe, because it is very easy to mess things up when preparing arugments.

This function is called within Fyber::trampoline to extract the arguments from the va_list::VaList.

Safety

This function is unsafe, because it is very easy to mess things up when extracting arugments.

This function is called within Fyber::trampoline to invoke the underlying callee function and process it’s results.

Safety

This function is unsafe, because it is very easy to mess things up when storing the callee’s result values.

Implementors