Struct axgeom::Range [−][src]
#[must_use]pub struct Range<T: Copy> { pub left: T, pub right: T, }
A 1d range. Internally represented as start and end. (not start and length) This means that subdivision does not result in any floating point calculations. The left value be <= the right value. There is no protection against "degenerate" Ranges where left>right.
Fields
left: T
right: T
Methods
impl<T: Copy + PartialOrd> Range<T>
[src]
impl<T: Copy + PartialOrd> Range<T>
pub fn contains(&self, pos: T) -> bool
[src]
pub fn contains(&self, pos: T) -> bool
Returns true if the point is inside of the range or on top of. True if pos>=self.left&&pos<=self.right
impl<T: Copy + Sub<Output = T>> Range<T>
[src]
impl<T: Copy + Sub<Output = T>> Range<T>
impl<T: Copy + Sub<Output = T> + Add<Output = T>> Range<T>
[src]
impl<T: Copy + Sub<Output = T> + Add<Output = T>> Range<T>
impl<T: Copy + Ord> Range<T>
[src]
impl<T: Copy + Ord> Range<T>
pub fn left_or_right_or_contain(&self, pos: &T) -> Ordering
[src]
pub fn left_or_right_or_contain(&self, pos: &T) -> Ordering
If the pos is to the left of the range, return less. If the pos is to the right of the range, return greater. If the pos intersects with the range, return equal.
pub fn grow_to_fit(&mut self, b: &Range<T>)
[src]
pub fn grow_to_fit(&mut self, b: &Range<T>)
pub fn contains_range(&self, val: &Range<T>) -> bool
[src]
pub fn contains_range(&self, val: &Range<T>) -> bool
Returns true if self contains the specified range.
pub fn get_intersection(&self, val: &Range<T>) -> Option<Range<T>>
[src]
pub fn get_intersection(&self, val: &Range<T>) -> Option<Range<T>>
Creates a range that represents the intersection range.
pub fn intersects(&self, val: &Range<T>) -> bool
[src]
pub fn intersects(&self, val: &Range<T>) -> bool
Returns true if two ranges intersect.
Trait Implementations
impl<T: Copy + Copy> Copy for Range<T>
[src]
impl<T: Copy + Copy> Copy for Range<T>
impl<T: Clone + Copy> Clone for Range<T>
[src]
impl<T: Clone + Copy> Clone for Range<T>
fn clone(&self) -> Range<T>
[src]
fn clone(&self) -> Range<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Debug + Copy> Debug for Range<T>
[src]
impl<T: Debug + Copy> Debug for Range<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Eq + Copy> Eq for Range<T>
[src]
impl<T: Eq + Copy> Eq for Range<T>
impl<T: PartialEq + Copy> PartialEq for Range<T>
[src]
impl<T: PartialEq + Copy> PartialEq for Range<T>