pub trait MixedPrecisionSupport: ArrayProtocol {
// Required methods
fn to_precision(
&self,
precision: Precision,
) -> CoreResult<Box<dyn MixedPrecisionSupport>>;
fn precision(&self) -> Precision;
fn supports_precision(&self, precision: Precision) -> bool;
fn as_array_protocol(&self) -> &dyn ArrayProtocol;
}Expand description
Trait for arrays that support mixed-precision operations.
Required Methods§
Sourcefn to_precision(
&self,
precision: Precision,
) -> CoreResult<Box<dyn MixedPrecisionSupport>>
fn to_precision( &self, precision: Precision, ) -> CoreResult<Box<dyn MixedPrecisionSupport>>
Convert the array to the specified precision.
Sourcefn supports_precision(&self, precision: Precision) -> bool
fn supports_precision(&self, precision: Precision) -> bool
Check if the array supports the specified precision.
Sourcefn as_array_protocol(&self) -> &dyn ArrayProtocol
fn as_array_protocol(&self) -> &dyn ArrayProtocol
Borrow this value as an ArrayProtocol trait object.
MixedPrecisionSupport has ArrayProtocol as a supertrait, but on stable
Rust a &dyn MixedPrecisionSupport cannot be upcast to &dyn ArrayProtocol
without the unstable trait_upcasting feature (RFC #65991). This method
provides that bridge explicitly: every implementor already is an
ArrayProtocol, so the default implementation simply returns self.
This allows mixed-precision arrays to be passed to operations that are
generic over &dyn ArrayProtocol (such as those in
crate::array_protocol::operations) on stable Rust.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<T, D> MixedPrecisionSupport for GPUNdarray<T, D>
Implement MixedPrecisionSupport for GPUNdarray.
impl<T, D> MixedPrecisionSupport for MixedPrecisionArray<T, D>
Implement MixedPrecisionSupport for MixedPrecisionArray.