pub struct UnitIntervalValue(/* private fields */);
Expand description
A container for a value falling on the range (0.0, 1.0) (exclusive, meaning the values 0.0 and 1.0 are not valid)
This is useful for safely defining decreasing scale factors.
Because this type is currently used only for computing the resized
dimensions of each level of the pyramid, the choice was made to support only
f32
. In the future support may be added for other floating-point types,
such as f64
, rational values, or fixed-point, if there arises a need for
such precision and/or performance.
Implementations§
Source§impl UnitIntervalValue
impl UnitIntervalValue
Sourcepub fn new<T: IntoUnitInterval>(val: T) -> Result<Self, ImagePyramidError>
pub fn new<T: IntoUnitInterval>(val: T) -> Result<Self, ImagePyramidError>
Attempts to create a new instance from the provided value
§Errors
- The value is not within the unit range
Trait Implementations§
Source§impl Clone for UnitIntervalValue
impl Clone for UnitIntervalValue
Source§fn clone(&self) -> UnitIntervalValue
fn clone(&self) -> UnitIntervalValue
Returns a duplicate 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 UnitIntervalValue
impl Debug for UnitIntervalValue
impl Copy for UnitIntervalValue
Auto Trait Implementations§
impl Freeze for UnitIntervalValue
impl RefUnwindSafe for UnitIntervalValue
impl Send for UnitIntervalValue
impl Sync for UnitIntervalValue
impl Unpin for UnitIntervalValue
impl UnwindSafe for UnitIntervalValue
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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more