Skip to main content

Registry

Struct Registry 

Source
pub struct Registry<S, T> { /* private fields */ }

Implementations§

Source§

impl<S, T: Send + Sync> Registry<S, T>

Source

pub fn register( &mut self, handler: impl Fn(&mut S, Backend, &[&T]) -> Result<T, Error> + Send + Sync + 'static, ) -> OperationId

Source

pub fn run( &self, nodes: &[Node], capacity: Capacity, history: &mut History, factory: impl Fn(Backend) -> Result<S, String> + Sync, ) -> Result<(Vec<T>, Report), String>

An accelerator is provided by the factory; its implementation can use any compute API. The result owns each output. Include retained outputs separately when budgeting RAM.

Source

pub fn run_interruptible( &self, nodes: &[Node], capacity: Capacity, history: &mut History, factory: impl Fn(Backend) -> Result<S, String> + Sync, cancelled: Option<&AtomicBool>, ) -> Result<(Vec<T>, Report), String>

Stop admitting new work after cancellation. Workers already in a callback finish before this method returns. No partial output list is returned.

Trait Implementations§

Source§

impl<S, T> Default for Registry<S, T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S, T> !RefUnwindSafe for Registry<S, T>

§

impl<S, T> !UnwindSafe for Registry<S, T>

§

impl<S, T> Forget for Registry<S, T>

§

impl<S, T> Freeze for Registry<S, T>
where Vec<Box<dyn Fn(&mut S, Backend, &[&T]) -> Result<T, Error> + Send + Sync>>: Freeze,

§

impl<S, T> Move for Registry<S, T>

§

impl<S, T> Send for Registry<S, T>
where Vec<Box<dyn Fn(&mut S, Backend, &[&T]) -> Result<T, Error> + Send + Sync>>: Send,

§

impl<S, T> Sync for Registry<S, T>
where Vec<Box<dyn Fn(&mut S, Backend, &[&T]) -> Result<T, Error> + Send + Sync>>: Sync,

§

impl<S, T> Unpin for Registry<S, T>
where Vec<Box<dyn Fn(&mut S, Backend, &[&T]) -> Result<T, Error> + Send + Sync>>: Unpin,

§

impl<S, T> UnsafeUnpin for Registry<S, T>
where Vec<Box<dyn Fn(&mut S, Backend, &[&T]) -> Result<T, Error> + Send + Sync>>: UnsafeUnpin,

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.