Enum Sample
pub enum Sample
A single red, green, blue, or alpha value.
Variants
-
F16(f16) A 16-bit float sample.
-
F32(f32) A 32-bit float sample.
-
U32(u32) An unsigned integer sample.
Implementations
impl Sample
fn f32(f32: f32) -> SelfCreate a sample containing a 32-bit float.
fn f16(f16: f16) -> SelfCreate a sample containing a 16-bit float.
fn u32(u32: u32) -> SelfCreate a sample containing a 32-bit integer.
fn to_f16(self) -> f16Convert the sample to an f16 value. This has lower precision than f32. Note: An f32 can only represent integers up to
1024as precise as a u32 could.fn to_f32(self) -> f32Convert the sample to an f32 value. Note: An f32 can only represent integers up to
8388608as precise as a u32 could.fn to_u32(self) -> u32Convert the sample to a u32. Rounds floats to integers the same way that
3.1 as u32does.fn is_nan(self) -> boolIs this value not a number?
fn is_zero(&self) -> boolIs this value zero or negative zero?
Trait Implementations
impl Clone for Sample
fn clone(&self) -> Self
impl Copy for Sample
impl Debug for Sample
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Sample
fn default() -> Self
impl From<f16> for Sample
fn from(f: f16) -> Self
impl From<f32> for Sample
fn from(f: f32) -> Self
impl From<u32> for Sample
fn from(f: u32) -> Self
impl FromNativeSample for Sample
fn from_f16(value: f16) -> Selffn from_f32(value: f32) -> Selffn from_u32(value: u32) -> Self
impl IntoNativeSample for Sample
fn to_f16(&self) -> f16fn to_f32(&self) -> f32fn to_u32(&self) -> u32
impl PartialEq for Sample
fn eq(&self, other: &Self) -> bool
impl ValidateResult for Sample
fn validate_result(&self, other: &Self, options: ValidationOptions, location: impl Fn() -> String) -> ValidationResult
impl<T> From<Option<T>> for Sample
where
T: Into<Self> + Default,
fn from(num: Option<T>) -> Self
Auto Trait Implementations
impl Freeze for Sample
impl RefUnwindSafe for Sample
impl Send for Sample
impl Sync for Sample
impl Unpin for Sample
impl UnsafeUnpin for Sample
impl UnwindSafe for Sample
Blanket Implementations
impl<R, P> ReadPrimitive<R> for Sample
where
R: Read + ReadEndian<P>,
P: Default,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for Sample
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for Sample
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for Sample
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Sample
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Sample
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Sample
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Sample
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for Sample
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for Sample
where
T: ?Sized,
impl<T> ToOwned for Sample
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Sample
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Sample
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Sample
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>