pub enum FloatToIntRounding {
Nearest,
Truncate,
}Expand description
Rounding applied when a floating-point sample is stored into an integer type.
Saturation at the destination bounds always happens, independent of this setting; only the treatment of the fractional part differs.
Variants§
Nearest
Round to the nearest integer, halves away from zero
(2.5 → 3, -2.5 → -3). This matches GDAL’s RasterIO behaviour and is
the default for every public entry point that does not take an explicit
rounding mode.
Truncate
Truncate towards zero (2.9 → 2, -2.9 → -2), i.e. plain C-style
(int)x semantics.
Used by RasterBuffer::convert_to
so that its results stay bit-for-bit identical to the historical
per-pixel implementation.
Trait Implementations§
Source§impl Clone for FloatToIntRounding
impl Clone for FloatToIntRounding
Source§fn clone(&self) -> FloatToIntRounding
fn clone(&self) -> FloatToIntRounding
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FloatToIntRounding
Source§impl Debug for FloatToIntRounding
impl Debug for FloatToIntRounding
Source§impl Default for FloatToIntRounding
impl Default for FloatToIntRounding
Source§fn default() -> FloatToIntRounding
fn default() -> FloatToIntRounding
Returns the “default value” for a type. Read more
impl Eq for FloatToIntRounding
Source§impl Hash for FloatToIntRounding
impl Hash for FloatToIntRounding
Source§impl PartialEq for FloatToIntRounding
impl PartialEq for FloatToIntRounding
impl StructuralPartialEq for FloatToIntRounding
Auto Trait Implementations§
impl Freeze for FloatToIntRounding
impl RefUnwindSafe for FloatToIntRounding
impl Send for FloatToIntRounding
impl Sync for FloatToIntRounding
impl Unpin for FloatToIntRounding
impl UnsafeUnpin for FloatToIntRounding
impl UnwindSafe for FloatToIntRounding
Blanket Implementations§
impl<T> Allocation for T
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