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 valueFiberProc: 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
type JoinHandle
type JoinHandle
JoinHandle type which will be returned from the Fyber::spawn
function
Required methods
unsafe fn start_fiber(self, inner: NonNull<Fiber>) -> Self::JoinHandle
unsafe fn start_fiber(self, inner: NonNull<Fiber>) -> Self::JoinHandle
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.
unsafe fn parse_args(args: VaList) -> Self::Args
unsafe fn parse_args(args: VaList) -> Self::Args
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.