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