Skip to main content

IsZero

Trait IsZero 

Source
pub trait IsZero {
    // Required method
    fn is_zero(&self) -> bool;
}
Expand description

Checks whether a length or geometry value is zero.

Implemented for the length types and for Point, Size, Bounds and Corners. For a Size, the check is true when either side is zero, because the area is then zero. For a Point, both coordinates must be zero. For Corners, all four corners must be zero.

§Examples

use gpui::{IsZero, px, size};

assert!(px(0.).is_zero());
assert!(size(px(10.), px(0.)).is_zero());
assert!(!size(px(10.), px(5.)).is_zero());

Required Methods§

Source

fn is_zero(&self) -> bool

Returns true if this value is zero.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§