Skip to main content

Allocator

Enum Allocator 

Source
pub enum Allocator {
    Thread(Thread),
    Process(Process),
    Tcp(TcpAllocator),
}
Expand description

Enumerates known implementors of Allocate. Passes trait method calls on to members.

Variants§

§

Thread(Thread)

Intra-thread allocator.

§

Process(Process)

Inter-thread, intra-process allocator (in either of two flavors, see Process).

§

Tcp(TcpAllocator)

Inter-process allocator (TCP-based, with a Process as its intra-process inner).

Implementations§

Source§

impl Allocator

Source

pub fn index(&self) -> usize

The index of the worker out of (0..self.peers()).

Source

pub fn peers(&self) -> usize

The number of workers.

Source

pub fn allocate<T>( &mut self, identifier: usize, ) -> (Vec<Box<dyn Push<T>>>, Box<dyn Pull<T>>)
where T: Exchangeable,

Constructs several send endpoints and one receive endpoint.

Source

pub fn broadcast<T>( &mut self, identifier: usize, ) -> (Box<dyn Push<T>>, Box<dyn Pull<T>>)
where T: Exchangeable + Clone,

Constructs several send endpoints and one receive endpoint.

Source

pub fn receive(&mut self)

Perform work before scheduling operators.

Source

pub fn release(&mut self)

Perform work after scheduling operators.

Source

pub fn events(&self) -> &Rc<RefCell<Vec<usize>>>

Provides access to the shared event queue.

Source

pub fn await_events(&self, duration: Option<Duration>)

Awaits communication events.

Source

pub fn pipeline<T>( &mut self, identifier: usize, ) -> (Pusher<T, Pusher<T>>, Puller<T, Puller<T>>)
where T: 'static,

Constructs a pipeline channel from the worker to itself.

By default, this method uses the thread-local channel constructor based on a shared VecDeque which updates the event queue.

Auto Trait Implementations§

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.