pub struct FixedPoint(/* private fields */);Expand description
A fixed-point decimal.
Implementations§
Source§impl FixedPoint
impl FixedPoint
Sourcepub const FACTOR: i64 = clap_sys::fixedpoint::CLAP_BEATTIME_FACTOR
pub const FACTOR: i64 = clap_sys::fixedpoint::CLAP_BEATTIME_FACTOR
The factor by witch to multiply a value in order to make it have the same fixed-point decimal representation as this type.
Sourcepub const fn from_bits(bits: i64) -> FixedPoint
pub const fn from_bits(bits: i64) -> FixedPoint
Creates a FixedPoint decimal from its internal, raw-byte representation.
Sourcepub const fn to_bits(&self) -> i64
pub const fn to_bits(&self) -> i64
Returns the internal, raw-byte representation of this FixedPoint decimal.
Sourcepub const fn from_int(val: i64) -> FixedPoint
pub const fn from_int(val: i64) -> FixedPoint
Creates a FixedPoint decimal from an integer value.
Sourcepub const fn to_int(&self) -> i64
pub const fn to_int(&self) -> i64
Returns the integer part of this FixedPoint decimal, discarding the decimal part.
Sourcepub const fn to_float(&self) -> f64
pub const fn to_float(&self) -> f64
Converts this fixed-point decimal to a floating-point value.
Note that this conversion loses some precision: the FixedPoint decimal has the full
64 bits of precision, whereas f64’s mantissa is only 52 bits wide.
Sourcepub fn from_float(val: f64) -> FixedPoint
pub fn from_float(val: f64) -> FixedPoint
Converts the given floating-point value to a FixedPoint decimal.
Trait Implementations§
Source§impl Add for FixedPoint
impl Add for FixedPoint
Source§type Output = FixedPoint
type Output = FixedPoint
The resulting type after applying the
+ operator.Source§fn add(self, rhs: FixedPoint) -> <FixedPoint as Add>::Output
fn add(self, rhs: FixedPoint) -> <FixedPoint as Add>::Output
Performs the
+ operation. Read moreSource§impl Clone for FixedPoint
impl Clone for FixedPoint
Source§fn clone(&self) -> FixedPoint
fn clone(&self) -> FixedPoint
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 FixedPoint
Source§impl Debug for FixedPoint
impl Debug for FixedPoint
Source§impl Default for FixedPoint
impl Default for FixedPoint
Source§fn default() -> FixedPoint
fn default() -> FixedPoint
Returns the “default value” for a type. Read more
impl Eq for FixedPoint
Source§impl From<f64> for FixedPoint
impl From<f64> for FixedPoint
Source§fn from(val: f64) -> FixedPoint
fn from(val: f64) -> FixedPoint
Converts to this type from the input type.
Source§impl Hash for FixedPoint
impl Hash for FixedPoint
Source§impl Ord for FixedPoint
impl Ord for FixedPoint
Source§fn cmp(&self, other: &FixedPoint) -> Ordering
fn cmp(&self, other: &FixedPoint) -> Ordering
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 PartialEq for FixedPoint
impl PartialEq for FixedPoint
Source§impl PartialOrd for FixedPoint
impl PartialOrd for FixedPoint
impl StructuralPartialEq for FixedPoint
Auto Trait Implementations§
impl Freeze for FixedPoint
impl RefUnwindSafe for FixedPoint
impl Send for FixedPoint
impl Sync for FixedPoint
impl Unpin for FixedPoint
impl UnsafeUnpin for FixedPoint
impl UnwindSafe for FixedPoint
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