ThreadedExecutor

Struct ThreadedExecutor 

Source
pub struct ThreadedExecutor<NID: PartialEq + Send, TID: PartialEq + Send> { /* private fields */ }
Expand description

Threaded Executor

The Threaded Executor stores nodes in a bunch of SimpleExecutors on given threads. On the update loop each of hte SimpleExecutors execute their nodes in parallel

Implementations§

Source§

impl<NID: PartialEq + Send, TID: PartialEq + Send> ThreadedExecutor<NID, TID>

Source

pub fn new(interrupt: Receiver<bool>, main_thread_id: TID) -> Self

Create a new Threaded Executor without any Nodes

Source

pub fn new_with( interrupt: Receiver<bool>, main_thread_id: TID, nodes: Vec<(Vec<Box<dyn Node<NID>>>, TID)>, ) -> Self

Creates a new Threaded executor with a given mapping for nodes

Trait Implementations§

Source§

impl<NID: PartialEq + Send + 'static, TID: PartialEq + Send + 'static> Executor<NID> for ThreadedExecutor<NID, TID>

Source§

type Context = TID

Optional Context for adding nodes with specific conditions
Source§

fn start(&mut self)

Starts the nodes contained by the executor
Source§

fn update_for_ms(&mut self, ms: u128)

Run the update loop for a set amount of time (in milliseconds)
Source§

fn update_loop(&mut self)

Run the update loop until the executor’s interrupt is called
Source§

fn check_interrupt(&mut self) -> bool

Check whether the program has been interrupted Read more
Source§

fn add_node(&mut self, node: Box<dyn Node<NID>>)

Add a node to the executor.
Source§

fn add_node_with_context( &mut self, node: Box<dyn Node<NID>>, _ctx: Self::Context, )

Add a node to the executor with some given context. Read more
Source§

fn remove_node(&mut self, id: &NID) -> Option<Box<dyn Node<NID>>>

Remove a node from the executor.

Auto Trait Implementations§

§

impl<NID, TID> Freeze for ThreadedExecutor<NID, TID>
where TID: Freeze,

§

impl<NID, TID> !RefUnwindSafe for ThreadedExecutor<NID, TID>

§

impl<NID, TID> Send for ThreadedExecutor<NID, TID>

§

impl<NID, TID> !Sync for ThreadedExecutor<NID, TID>

§

impl<NID, TID> Unpin for ThreadedExecutor<NID, TID>
where TID: Unpin,

§

impl<NID, TID> !UnwindSafe for ThreadedExecutor<NID, TID>

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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

Source§

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.