Struct zng_unit::DistanceKey
source · pub struct DistanceKey(/* private fields */);
Expand description
Comparable key that represents the absolute distance between two pixel points.
Computing the actual distance only for comparison is expensive, this key avoids the conversion to float and square-root operation.
Implementations§
source§impl DistanceKey
impl DistanceKey
sourcepub const NONE_MAX: DistanceKey = _
pub const NONE_MAX: DistanceKey = _
Value that is always greater than any distance key.
sourcepub const NONE_MIN: DistanceKey = _
pub const NONE_MIN: DistanceKey = _
Value that is always smaller than any distance key.
sourcepub const MAX: DistanceKey = _
pub const MAX: DistanceKey = _
Maximum distance.
sourcepub const MIN: DistanceKey = _
pub const MIN: DistanceKey = _
Minimum distance.
sourcepub fn from_points(a: PxPoint, b: PxPoint) -> Self
pub fn from_points(a: PxPoint, b: PxPoint) -> Self
New distance key computed from two points.
sourcepub fn from_distance(d: Px) -> Self
pub fn from_distance(d: Px) -> Self
New distance key from already computed actual distance.
Note that computing the actual distance is slower then using from_points
to compute just the distance key.
Trait Implementations§
source§impl Clone for DistanceKey
impl Clone for DistanceKey
source§fn clone(&self) -> DistanceKey
fn clone(&self) -> DistanceKey
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<'de> Deserialize<'de> for DistanceKey
impl<'de> Deserialize<'de> for DistanceKey
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for DistanceKey
impl Hash for DistanceKey
source§impl Ord for DistanceKey
impl Ord for DistanceKey
source§fn cmp(&self, other: &DistanceKey) -> Ordering
fn cmp(&self, other: &DistanceKey) -> Ordering
1.21.0 · 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
source§impl PartialEq for DistanceKey
impl PartialEq for DistanceKey
source§impl PartialOrd for DistanceKey
impl PartialOrd for DistanceKey
source§impl Serialize for DistanceKey
impl Serialize for DistanceKey
impl Copy for DistanceKey
impl Eq for DistanceKey
impl Pod for DistanceKey
impl StructuralPartialEq for DistanceKey
Auto Trait Implementations§
impl Freeze for DistanceKey
impl RefUnwindSafe for DistanceKey
impl Send for DistanceKey
impl Sync for DistanceKey
impl Unpin for DistanceKey
impl UnwindSafe for DistanceKey
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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
)