pub struct Fyber<F, T> { /* private fields */ }
Expand description
A helper struct which is used to store information about a fiber being created. It’s only utility is the generic parameter which are associated with it.
Implementations§
source§impl<'f, F, T> Fyber<F, T>where
F: FnOnce() -> T + 'f,
T: 'f,
impl<'f, F, T> Fyber<F, T>where
F: FnOnce() -> T + 'f,
T: 'f,
sourcepub fn spawn_and_yield(
name: String,
f: F,
is_joinable: bool,
attr: Option<&FiberAttr>
) -> Result<Result<JoinHandle<'f, T>, FiberId>>
pub fn spawn_and_yield( name: String, f: F, is_joinable: bool, attr: Option<&FiberAttr> ) -> Result<Result<JoinHandle<'f, T>, FiberId>>
Creates a fiber and immediately yields execution to it.
Returns a Ok(Ok(
JoinHandle
))
if is_joinable
is true
.
Returns Ok(Err(
FiberId
))
if is_joinable
is false
.
Returns an error if is_joinable
is false
and F
returns a non
zero-sized value.
sourcepub fn spawn_deferred(
name: String,
f: F,
is_joinable: bool,
attr: Option<&FiberAttr>
) -> Result<Result<JoinHandle<'f, T>, Option<FiberId>>>
pub fn spawn_deferred( name: String, f: F, is_joinable: bool, attr: Option<&FiberAttr> ) -> Result<Result<JoinHandle<'f, T>, Option<FiberId>>>
Creates a fiber and schedules it for execution at some point later. Does NOT yield.
Returns a Ok(Ok(
JoinHandle
))
if is_joinable
is true
.
Returns Ok(Err(Some(
FiberId
)))
if is_joinable
is false
and
has_fiber_id
returns true
.
Returns an error if is_joinable
is false
and F
returns a non
zero-sized value.
Panicking
May panic if the current tarantool executable doesn’t support the
fiber_set_ctx
api.