Struct drone_core::fib::Chain [−][src]
A lock-free list of fibers.
Implementations
impl Chain
[src]
pub const fn new() -> Self
[src]
Creates an empty fiber chain.
pub fn add<F: RootFiber>(&self, fib: F)
[src]
Adds a fiber first in the chain.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the chain is empty.
pub unsafe fn drain(
&self
) -> Drain<'_, impl FnMut(*mut ListNode<Node<()>>) -> bool>
[src]
&self
) -> Drain<'_, impl FnMut(*mut ListNode<Node<()>>) -> bool>
Returns an iterator that advances each fiber in the chain, returning completed ones.
Examples
The returned iterator can be simply dropped, it’s destructor will drop all completed fibers:
use drone_core::fib::Chain; let chain = Chain::new(); unsafe { drop(chain.drain()); // run the iterator and drop completed fibers }
Check if there is at least one active fiber:
use drone_core::fib::Chain; let chain = Chain::new(); let drain = unsafe { chain.drain() }; if drain.is_end() { println!("No active fibers to react to this interrupt"); }
Safety
This method must not be called again when the previous iterator is still alive.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,