pub struct AcceleratorBuilder { /* private fields */ }Expand description
Ergonomic builder for creating a GpuAccelerator.
Tries GPU first; falls back to CPU automatically.
§Example
use oximedia_gpu::accelerator::AcceleratorBuilder;
let acc = AcceleratorBuilder::new()
.prefer_gpu(true)
.build()?;
println!("Active backend: {}", acc.name());Implementations§
Source§impl AcceleratorBuilder
impl AcceleratorBuilder
Sourcepub fn prefer_gpu(self, value: bool) -> Self
pub fn prefer_gpu(self, value: bool) -> Self
Set whether to prefer GPU (default: true).
Sourcepub fn build(self) -> Result<Box<dyn GpuAccelerator>>
pub fn build(self) -> Result<Box<dyn GpuAccelerator>>
Build the accelerator.
Returns Ok(Box<dyn GpuAccelerator>). Never fails because a CPU
fallback is always available.
§Errors
This method never returns Err in practice (CPU fallback is always
constructed), but the signature uses Result to allow future error
propagation.
Sourcepub fn build_cpu() -> CpuAccelerator
pub fn build_cpu() -> CpuAccelerator
Build a CPU-only accelerator directly.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AcceleratorBuilder
impl RefUnwindSafe for AcceleratorBuilder
impl Send for AcceleratorBuilder
impl Sync for AcceleratorBuilder
impl Unpin for AcceleratorBuilder
impl UnsafeUnpin for AcceleratorBuilder
impl UnwindSafe for AcceleratorBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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