Struct rect_iter::RectRange [−][src]
pub struct RectRange<T: Num + PartialOrd> { /* fields omitted */ }
RectRange is rectangle representation using std::ops::Range.
Diffrent from RangeIntoIterator implementation and iter method(with 'clone').
Methods
impl<T: Num + PartialOrd> RectRange<T>[src]
impl<T: Num + PartialOrd> RectRange<T>pub fn new(lx: T, ly: T, ux: T, uy: T) -> Option<RectRange<T>>[src]
pub fn new(lx: T, ly: T, ux: T, uy: T) -> Option<RectRange<T>>construct a range from left x, lower y, right x, upper y
pub fn zero_start(x: T, y: T) -> Option<RectRange<T>>[src]
pub fn zero_start(x: T, y: T) -> Option<RectRange<T>>construct a range x_range: 0..x, y_range: 0..y
pub fn from_point<P: IntoTuple2<T>>(p: P) -> Option<RectRange<T>>[src]
pub fn from_point<P: IntoTuple2<T>>(p: P) -> Option<RectRange<T>>construct a range x_range: 0..p.x, y_range: 0..p.y
pub fn from_ranges(x_range: Range<T>, y_range: Range<T>) -> Option<RectRange<T>>[src]
pub fn from_ranges(x_range: Range<T>, y_range: Range<T>) -> Option<RectRange<T>>construct a range x_range: 0..x, y_range: 0..y
pub fn contains<P: IntoTuple2<T>>(&self, p: P) -> bool[src]
pub fn contains<P: IntoTuple2<T>>(&self, p: P) -> boolchecks if the range contains the point
pub fn get_x(&self) -> &Range<T>[src]
pub fn get_x(&self) -> &Range<T>get a reference of x range
pub fn get_y(&self) -> &Range<T>[src]
pub fn get_y(&self) -> &Range<T>get a reference of y range
pub fn get_mut_x(&mut self) -> &mut Range<T>[src]
pub fn get_mut_x(&mut self) -> &mut Range<T>get a mutable reference of x range
pub fn get_mut_y(&mut self) -> &mut Range<T>[src]
pub fn get_mut_y(&mut self) -> &mut Range<T>get a mutable reference of y range
pub fn is_valid(&self) -> bool[src]
pub fn is_valid(&self) -> boolchecks if the range is valid or not
impl<T: Num + PartialOrd + Clone> RectRange<T>[src]
impl<T: Num + PartialOrd + Clone> RectRange<T>pub fn cloned_x(&self) -> Range<T>[src]
pub fn cloned_x(&self) -> Range<T>get x range
pub fn cloned_y(&self) -> Range<T>[src]
pub fn cloned_y(&self) -> Range<T>get y range
pub fn slide<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>[src]
pub fn slide<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>slide range by the given point
pub fn slide_start<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>[src]
pub fn slide_start<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>slide start point without checking
pub fn slide_end<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>[src]
pub fn slide_end<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>slide end point without checking
pub fn xlen(&self) -> T[src]
pub fn xlen(&self) -> Tthe length in the x-axis deirection
pub fn ylen(&self) -> T[src]
pub fn ylen(&self) -> Tthe length of in the y-axis deirection
pub fn area(&self) -> T[src]
pub fn area(&self) -> Tcalc the area of the range
pub fn intersects(&self, other: &RectRange<T>) -> bool[src]
pub fn intersects(&self, other: &RectRange<T>) -> booljudges if 2 ranges have intersection
pub fn intersection(&self, other: &RectRange<T>) -> Option<RectRange<T>>[src]
pub fn intersection(&self, other: &RectRange<T>) -> Option<RectRange<T>>gets the intersection of 2 ranges
pub fn upper_left(&self) -> (T, T)[src]
pub fn upper_left(&self) -> (T, T)get the upper left corner(inclusive)
pub fn upper_right(&self) -> (T, T)[src]
pub fn upper_right(&self) -> (T, T)get the upper right corner(inclusive)
pub fn lower_left(&self) -> (T, T)[src]
pub fn lower_left(&self) -> (T, T)get the lower left corner(inclusive)
pub fn lower_right(&self) -> (T, T)[src]
pub fn lower_right(&self) -> (T, T)get the lower right corner(inclusive)
pub fn is_edge<P: IntoTuple2<T>>(&self, p: P) -> bool[src]
pub fn is_edge<P: IntoTuple2<T>>(&self, p: P) -> boolchecks if the point is on the edge of the rectangle
pub fn is_vert_edge<P: IntoTuple2<T>>(&self, p: P) -> bool[src]
pub fn is_vert_edge<P: IntoTuple2<T>>(&self, p: P) -> boolchecks if the point is on the vertical edge of the rectangle
pub fn is_horiz_edge<P: IntoTuple2<T>>(&self, p: P) -> bool[src]
pub fn is_horiz_edge<P: IntoTuple2<T>>(&self, p: P) -> boolchecks if the point is on the horizoni edge of the rectangle
impl<T: Num + PartialOrd + Copy> RectRange<T>[src]
impl<T: Num + PartialOrd + Copy> RectRange<T>pub fn from_rect<U>(rect: TypedRect<T, U>) -> Option<RectRange<T>>[src]
pub fn from_rect<U>(rect: TypedRect<T, U>) -> Option<RectRange<T>>pub fn to_rect<U>(&self) -> TypedRect<T, U>[src]
pub fn to_rect<U>(&self) -> TypedRect<T, U>pub fn from_corners<P: IntoTuple2<T>>(lu: P, rd: P) -> Option<RectRange<T>>[src]
pub fn from_corners<P: IntoTuple2<T>>(lu: P, rd: P) -> Option<RectRange<T>>generate RectRange from corners(lower: inclusive, upper: exclusive)
ⓘImportant traits for RectIter<T>pub fn iter(&self) -> RectIter<T>[src]
pub fn iter(&self) -> RectIter<T>get iterator from reference
pub fn scale(self, sc: T) -> RectRange<T>[src]
pub fn scale(self, sc: T) -> RectRange<T>expand the rectangle
impl<T: Num + PartialOrd + ToPrimitive + Copy> RectRange<T>[src]
impl<T: Num + PartialOrd + ToPrimitive + Copy> RectRange<T>pub fn to_u8(self) -> Option<RectRange<u8>>[src]
pub fn to_u8(self) -> Option<RectRange<u8>>pub fn to_u16(self) -> Option<RectRange<u16>>[src]
pub fn to_u16(self) -> Option<RectRange<u16>>pub fn to_u32(self) -> Option<RectRange<u32>>[src]
pub fn to_u32(self) -> Option<RectRange<u32>>pub fn to_u64(self) -> Option<RectRange<u64>>[src]
pub fn to_u64(self) -> Option<RectRange<u64>>pub fn to_i8(self) -> Option<RectRange<i8>>[src]
pub fn to_i8(self) -> Option<RectRange<i8>>pub fn to_i16(self) -> Option<RectRange<i16>>[src]
pub fn to_i16(self) -> Option<RectRange<i16>>pub fn to_i32(self) -> Option<RectRange<i32>>[src]
pub fn to_i32(self) -> Option<RectRange<i32>>pub fn to_i64(self) -> Option<RectRange<i64>>[src]
pub fn to_i64(self) -> Option<RectRange<i64>>pub fn to_usize(self) -> Option<RectRange<usize>>[src]
pub fn to_usize(self) -> Option<RectRange<usize>>impl<T: Num + PartialOrd + Copy + FromPrimitive + ToPrimitive> RectRange<T>[src]
impl<T: Num + PartialOrd + Copy + FromPrimitive + ToPrimitive> RectRange<T>pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizereturns self.xlen * self.ylen as usize
pub fn nth(&self, n: usize) -> Option<(T, T)>[src]
pub fn nth(&self, n: usize) -> Option<(T, T)>return 'nth' element same as RectIter::nth, but much faster(O(1))
pub fn index<P: IntoTuple2<T>>(&self, p: P) -> Option<usize>[src]
pub fn index<P: IntoTuple2<T>>(&self, p: P) -> Option<usize>take Point and return 0-start unique index using the same order as RectIter
Trait Implementations
impl<T: Clone + Num + PartialOrd> Clone for RectRange<T>[src]
impl<T: Clone + Num + PartialOrd> Clone for RectRange<T>fn clone(&self) -> RectRange<T>[src]
fn clone(&self) -> RectRange<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 + Num + PartialOrd> Debug for RectRange<T>[src]
impl<T: Debug + Num + PartialOrd> Debug for RectRange<T>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<T: PartialEq + Num + PartialOrd> PartialEq for RectRange<T>[src]
impl<T: PartialEq + Num + PartialOrd> PartialEq for RectRange<T>fn eq(&self, other: &RectRange<T>) -> bool[src]
fn eq(&self, other: &RectRange<T>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &RectRange<T>) -> bool[src]
fn ne(&self, other: &RectRange<T>) -> boolThis method tests for !=.
impl<T: Eq + Num + PartialOrd> Eq for RectRange<T>[src]
impl<T: Eq + Num + PartialOrd> Eq for RectRange<T>impl<T: Hash + Num + PartialOrd> Hash for RectRange<T>[src]
impl<T: Hash + Num + PartialOrd> Hash for RectRange<T>fn hash<__HT: Hasher>(&self, state: &mut __HT)[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl<T: Num + PartialOrd + Copy> IntoIterator for RectRange<T>[src]
impl<T: Num + PartialOrd + Copy> IntoIterator for RectRange<T>