Struct tarantool::fiber::Fyber

source ·
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,

source

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.

source

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.

source

pub fn spawn_lua( name: String, f: F, _attr: Option<&FiberAttr> ) -> Result<JoinHandle<'f, T>>

Creates a joinable LUA fiber and schedules it for execution at some point later. Does NOT yield.

Trait Implementations§

source§

impl<F, T> Debug for Fyber<F, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<F, T> RefUnwindSafe for Fyber<F, T>

§

impl<F, T> Send for Fyber<F, T>
where F: Send, T: Send,

§

impl<F, T> Sync for Fyber<F, T>
where F: Sync, T: Sync,

§

impl<F, T> Unpin for Fyber<F, T>
where F: Unpin, T: Unpin,

§

impl<F, T> UnwindSafe for Fyber<F, T>
where F: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.