pub struct Fixed(/* private fields */);Expand description
A SANE fixed-point number (SANE_Fixed): 16 integer bits, 16 fractional
bits, from about -32768 to 32767.99998 in steps of 1/65536.
use libsane::Fixed;
let width = Fixed::from_f64(215.9);
assert!((width.to_f64() - 215.9).abs() < 1.0 / 65536.0);
assert_eq!(Fixed::from(3).to_f64(), 3.0);Implementations§
Source§impl Fixed
impl Fixed
Sourcepub const fn from_raw(raw: SANE_Fixed) -> Self
pub const fn from_raw(raw: SANE_Fixed) -> Self
The fixed-point number with this raw representation.
Sourcepub const fn to_raw(self) -> SANE_Fixed
pub const fn to_raw(self) -> SANE_Fixed
The raw representation (the value multiplied by 65536).
Trait Implementations§
impl Copy for Fixed
impl Eq for Fixed
Source§impl Ord for Fixed
impl Ord for Fixed
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Fixed
impl PartialOrd for Fixed
impl StructuralPartialEq for Fixed
Auto Trait Implementations§
impl Forget for Fixed
impl Freeze for Fixed
impl Move for Fixed
impl RefUnwindSafe for Fixed
impl Send for Fixed
impl Sync for Fixed
impl Unpin for Fixed
impl UnsafeUnpin for Fixed
impl UnwindSafe for Fixed
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