[][src]Struct smartpool_spatial::SpatialChannel

pub struct SpatialChannel<S: CoordSpace> where
    S::Coord: Copy
{ pub focus: Arc<Atomic<S::Coord>>, // some fields omitted }

A priority channel based on the manhattan tree, where each task corresponds to a coordinate in some coordinate space. A shared, atomic coordinate focus is stored, which can be shared between multiple SpatialChannels, and modified externally. The SpatialChannel will always execute the task with the lowest manhattan distance to the current value of the focus.

Fields

focus: Arc<Atomic<S::Coord>>

Methods

impl<S: CoordSpace> SpatialChannel<S> where
    S::Coord: Copy
[src]

pub fn new(focus: Arc<Atomic<S::Coord>>, space: S) -> Self[src]

Trait Implementations

impl<S: CoordSpace + Default> Default for SpatialChannel<S> where
    S::Coord: Copy + ZeroCoord
[src]

impl<S: CoordSpace> Channel for SpatialChannel<S> where
    S::Coord: Copy
[src]

fn into_shared(self) -> Arc<RwLock<Self>>[src]

Wrap self in a reference counted read/write lock, which is still a channel, and can have shared ownership, allowing it to be used in a scheduler. Read more

impl<S: CoordSpace> ExecParam for SpatialChannel<S> where
    S::Coord: Copy
[src]

type Param = S::Coord

fn exec<impl Future + Send + 'static>(
    &self,
    future: impl Future + Send + 'static,
    param: Self::Param
) where
    impl Future + Send + 'static: 'static + Send + Future<Item = (), Error = ()>, 
[src]

Execute a future on this channel.

fn exec_push<I, E, impl Future + Send + 'static>(
    &self,
    future: impl Future + Send + 'static,
    param: Self::Param
) -> PushFutureRecv<I, E> where
    E: 'static + Send,
    I: 'static + Send,
    impl Future + Send + 'static: 'static + Send + Future<Item = I, Error = E>, 
[src]

Execute a future on this channel, and push the result to a push future.

Auto Trait Implementations

impl<S> Send for SpatialChannel<S> where
    S: Send,
    <S as CoordSpace>::Coord: Send

impl<S> Sync for SpatialChannel<S> where
    S: Send,
    <S as CoordSpace>::Coord: Send

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.