Struct coaster::backend::Backend

source ·
pub struct Backend<F: IFramework> {
    pub framework: Box<F>,
    /* private fields */
}
Expand description

Defines the main and highest struct of Coaster.

Fields§

§framework: Box<F>

Provides the Framework.

The Framework implementation such as OpenCL, CUDA, etc. defines, which should be used and determines which hardwares will be available and how parallel kernel functions can be executed.

Default: Native

Implementations§

source§

impl<F: IFramework + Clone> Backend<F>

Defines the functionality of the Backend.

source

pub fn new(config: BackendConfig<'_, F>) -> Result<Backend<F>, Error>

Initialize a new native Backend from a BackendConfig.

source

pub fn hardwares(&self) -> &[F::H]

Returns the available hardware.

source

pub fn framework(&self) -> &F

Returns the backend framework.

source

pub fn device(&self) -> &F::D

Returns the backend device.

Trait Implementations§

source§

impl<F: Clone + IFramework> Clone for Backend<F>
where F::D: Clone,

source§

fn clone(&self) -> Backend<F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: Debug + IFramework> Debug for Backend<F>
where F::D: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl IBackend for Backend<Cuda>

§

type F = Cuda

Represents the Framework of a Backend.
source§

fn device(&self) -> &Context

Returns the backend device.
source§

fn synchronize(&self) -> Result<(), Error>

Synchronize backend.
source§

fn default() -> Result<Backend<Self::F>, Error>
where Self: Sized,

Try to create a default backend.
source§

impl IBackend for Backend<Native>

§

type F = Native

Represents the Framework of a Backend.
source§

fn device(&self) -> &Cpu

Returns the backend device.
source§

fn default() -> Result<Backend<Self::F>, Error>
where Self: Sized,

Try to create a default backend.
source§

fn synchronize(&self) -> Result<(), Error>

Synchronize backend.

Auto Trait Implementations§

§

impl<F> RefUnwindSafe for Backend<F>

§

impl<F> Send for Backend<F>
where F: Send, <F as IFramework>::D: Send,

§

impl<F> Sync for Backend<F>
where F: Sync, <F as IFramework>::D: Sync,

§

impl<F> Unpin for Backend<F>
where <F as IFramework>::D: Unpin,

§

impl<F> UnwindSafe for Backend<F>
where F: UnwindSafe, <F as IFramework>::D: UnwindSafe,

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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

§

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.