Struct png::ScaledFloat
source · pub struct ScaledFloat(/* private fields */);
Expand description
An unsigned integer scaled version of a floating point value, equivalent to an integer quotient with fixed denominator (100_000)).
Implementations§
source§impl 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§
source§impl Clone for ScaledFloat
impl Clone for ScaledFloat
source§fn clone(&self) -> ScaledFloat
fn clone(&self) -> ScaledFloat
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ScaledFloat
impl Debug for ScaledFloat
source§impl PartialEq for ScaledFloat
impl PartialEq for ScaledFloat
source§fn 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 ==
.impl Copy for ScaledFloat
impl Eq for ScaledFloat
impl StructuralPartialEq for ScaledFloat
Auto Trait Implementations§
impl Freeze for ScaledFloat
impl RefUnwindSafe for ScaledFloat
impl Send for ScaledFloat
impl Sync for ScaledFloat
impl Unpin for ScaledFloat
impl UnwindSafe for ScaledFloat
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> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)