Struct png::ScaledFloat
source · [−]pub struct ScaledFloat(_);
Expand description
An unsigned integer scaled version of a floating point value, equivalent to an integer quotient with fixed denominator (100_000)).
Implementations
sourceimpl ScaledFloat
impl ScaledFloat
sourcepub fn in_range(value: f32) -> bool
pub fn in_range(value: f32) -> bool
Gets whether the value is within the clamped range of this type.
sourcepub fn exact(value: f32) -> bool
pub fn exact(value: f32) -> bool
Gets whether the value can be exactly converted in round-trip.
sourcepub fn new(value: f32) -> Self
pub fn new(value: f32) -> Self
Slightly inaccurate scaling and quantization. Clamps the value into the representable range if it is negative or too large.
sourcepub fn from_scaled(val: u32) -> Self
pub fn from_scaled(val: u32) -> Self
Fully accurate construction from a value scaled as per specification.
sourcepub fn into_scaled(self) -> u32
pub fn into_scaled(self) -> u32
Get the accurate encoded value.
sourcepub fn into_value(self) -> f32
pub fn into_value(self) -> f32
Get the unscaled value as a floating point.
Trait Implementations
sourceimpl Clone for ScaledFloat
impl Clone for ScaledFloat
sourcefn clone(&self) -> ScaledFloat
fn clone(&self) -> ScaledFloat
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ScaledFloat
impl Debug for ScaledFloat
sourceimpl PartialEq<ScaledFloat> for ScaledFloat
impl PartialEq<ScaledFloat> for ScaledFloat
sourcefn eq(&self, other: &ScaledFloat) -> bool
fn eq(&self, other: &ScaledFloat) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ScaledFloat) -> bool
fn ne(&self, other: &ScaledFloat) -> bool
This method tests for !=
.
impl Copy for ScaledFloat
impl Eq for ScaledFloat
impl StructuralEq for ScaledFloat
impl StructuralPartialEq for ScaledFloat
Auto Trait Implementations
impl RefUnwindSafe for ScaledFloat
impl Send for ScaledFloat
impl Sync for ScaledFloat
impl Unpin for ScaledFloat
impl UnwindSafe for ScaledFloat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more