pub struct DataBounds<X, Y>{
pub min_x: X,
pub max_x: X,
pub min_y: Y,
pub max_y: Y,
}Expand description
Represents the bounds of a dataset in 2D space
Fields§
§min_x: XMinimum X value
max_x: XMaximum X value
min_y: YMinimum Y value
max_y: YMaximum Y value
Implementations§
Source§impl<X, Y> DataBounds<X, Y>
impl<X, Y> DataBounds<X, Y>
Sourcepub fn new(min_x: X, max_x: X, min_y: Y, max_y: Y) -> DataResult<Self>
pub fn new(min_x: X, max_x: X, min_y: Y, max_y: Y) -> DataResult<Self>
Create new data bounds
Sourcepub fn contains<P>(&self, point: &P) -> boolwhere
P: DataPoint<X = X, Y = Y>,
pub fn contains<P>(&self, point: &P) -> boolwhere
P: DataPoint<X = X, Y = Y>,
Check if a point is within these bounds
Sourcepub fn expand_to_include<P>(&mut self, point: &P)where
P: DataPoint<X = X, Y = Y>,
pub fn expand_to_include<P>(&mut self, point: &P)where
P: DataPoint<X = X, Y = Y>,
Expand bounds to include a new point
Source§impl DataBounds<f32, f32>
impl DataBounds<f32, f32>
Sourcepub fn with_padding(&self, padding_percent: f32) -> Self
pub fn with_padding(&self, padding_percent: f32) -> Self
Create bounds with some padding around the data
Sourcepub fn nice_bounds(&self) -> Self
pub fn nice_bounds(&self) -> Self
Create bounds that are nice for display (rounded to nice numbers)
Trait Implementations§
Source§impl<X, Y> Clone for DataBounds<X, Y>
impl<X, Y> Clone for DataBounds<X, Y>
Source§fn clone(&self) -> DataBounds<X, Y>
fn clone(&self) -> DataBounds<X, Y>
Returns a duplicate 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<X, Y> Debug for DataBounds<X, Y>
impl<X, Y> Debug for DataBounds<X, Y>
Source§impl<X, Y> PartialEq for DataBounds<X, Y>
impl<X, Y> PartialEq for DataBounds<X, Y>
impl<X, Y> Copy for DataBounds<X, Y>
impl<X, Y> StructuralPartialEq for DataBounds<X, Y>
Auto Trait Implementations§
impl<X, Y> Freeze for DataBounds<X, Y>
impl<X, Y> RefUnwindSafe for DataBounds<X, Y>where
X: RefUnwindSafe,
Y: RefUnwindSafe,
impl<X, Y> Send for DataBounds<X, Y>
impl<X, Y> Sync for DataBounds<X, Y>
impl<X, Y> Unpin for DataBounds<X, Y>
impl<X, Y> UnwindSafe for DataBounds<X, Y>where
X: UnwindSafe,
Y: UnwindSafe,
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.