[−][src]Struct rect_iter::RectRange
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]
pub fn new(lx: T, ly: T, ux: T, uy: T) -> Option<RectRange<T>>
[src]
construct a range from left x, lower y, right x, upper y
pub fn zero_start(x: T, y: T) -> Option<RectRange<T>>
[src]
construct a range x_range: 0..x, y_range: 0..y
pub fn from_point<P: IntoTuple2<T>>(p: P) -> Option<RectRange<T>>
[src]
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]
construct a range x_range: 0..x, y_range: 0..y
pub fn contains<P: IntoTuple2<T>>(&self, p: P) -> bool
[src]
checks if the range contains the point
pub fn get_x(&self) -> &Range<T>
[src]
get a reference of x range
pub fn get_y(&self) -> &Range<T>
[src]
get a reference of y range
pub fn get_mut_x(&mut self) -> &mut Range<T>
[src]
get a mutable reference of x range
pub fn get_mut_y(&mut self) -> &mut Range<T>
[src]
get a mutable reference of y range
pub fn is_valid(&self) -> bool
[src]
checks if the range is valid or not
impl<T: Num + PartialOrd + Clone> RectRange<T>
[src]
pub fn cloned_x(&self) -> Range<T>
[src]
get x range
pub fn cloned_y(&self) -> Range<T>
[src]
get y range
pub fn slide<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>
[src]
slide range by the given point
pub fn slide_start<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>
[src]
slide start point without checking
pub fn slide_end<P: IntoTuple2<T>>(self, t: P) -> RectRange<T>
[src]
slide end point without checking
pub fn xlen(&self) -> T
[src]
the length in the x-axis deirection
pub fn ylen(&self) -> T
[src]
the length of in the y-axis deirection
pub fn area(&self) -> T
[src]
calc the area of the range
pub fn intersects(&self, other: &RectRange<T>) -> bool
[src]
judges if 2 ranges have intersection
pub fn intersection(&self, other: &RectRange<T>) -> Option<RectRange<T>>
[src]
gets the intersection of 2 ranges
pub fn lower_left(&self) -> (T, T)
[src]
get the lower left corner(inclusive)
pub fn lower_right(&self) -> (T, T)
[src]
get the lower right corner(inclusive)
pub fn upper_left(&self) -> (T, T)
[src]
get the upper left corner(inclusive)
pub fn upper_right(&self) -> (T, T)
[src]
get the upper right corner(inclusive)
pub fn is_edge<P: IntoTuple2<T>>(&self, p: P) -> bool
[src]
checks if the point is on the edge of the rectangle
pub fn is_vert_edge<P: IntoTuple2<T>>(&self, p: P) -> bool
[src]
checks if the point is on the vertical edge of the rectangle
pub fn is_horiz_edge<P: IntoTuple2<T>>(&self, p: P) -> bool
[src]
checks if the point is on the horizoni edge of the rectangle
impl<T: Num + PartialOrd + Copy> RectRange<T>
[src]
pub fn from_rect<U>(rect: Rect<T, U>) -> Option<RectRange<T>>
[src]
pub fn to_rect<U>(&self) -> Rect<T, U>
[src]
pub fn from_corners<P: IntoTuple2<T>>(lu: P, rd: P) -> Option<RectRange<T>>
[src]
generate RectRange from corners(lower: inclusive, upper: exclusive)
ⓘImportant traits for RectIter<T>pub fn iter(&self) -> RectIter<T>
[src]
get iterator from reference
pub fn scale(self, sc: T) -> RectRange<T>
[src]
expand the rectangle
impl<T: Num + PartialOrd + ToPrimitive + Copy> RectRange<T>
[src]
pub fn to_u8(self) -> Option<RectRange<u8>>
[src]
pub fn to_u16(self) -> Option<RectRange<u16>>
[src]
pub fn to_u32(self) -> Option<RectRange<u32>>
[src]
pub fn to_u64(self) -> Option<RectRange<u64>>
[src]
pub fn to_i8(self) -> Option<RectRange<i8>>
[src]
pub fn to_i16(self) -> Option<RectRange<i16>>
[src]
pub fn to_i32(self) -> Option<RectRange<i32>>
[src]
pub fn to_i64(self) -> Option<RectRange<i64>>
[src]
pub fn to_usize(self) -> Option<RectRange<usize>>
[src]
impl<T: Num + PartialOrd + Copy + FromPrimitive + ToPrimitive> RectRange<T>
[src]
pub fn len(&self) -> usize
[src]
returns self.xlen * self.ylen
as usize
pub fn nth(&self, n: usize) -> Option<(T, T)>
[src]
return 'nth' element same as RectIter::nth, but much faster(O(1))
pub fn index<P: IntoTuple2<T>>(&self, p: P) -> Option<usize>
[src]
take Point and return 0-start unique index using the same order as RectIter
Trait Implementations
impl<T: Num + PartialOrd + Copy> IntoIterator for RectRange<T>
[src]
type Item = (T, T)
The type of the elements being iterated over.
type IntoIter = RectIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: Clone + Num + PartialOrd> Clone for RectRange<T>
[src]
fn clone(&self) -> RectRange<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialEq + Num + PartialOrd> PartialEq<RectRange<T>> for RectRange<T>
[src]
impl<T: Eq + Num + PartialOrd> Eq for RectRange<T>
[src]
impl<T: Debug + Num + PartialOrd> Debug for RectRange<T>
[src]
impl<T: Hash + Num + PartialOrd> Hash for RectRange<T>
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Num + PartialOrd> Serialize for RectRange<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, T: Num + PartialOrd> Deserialize<'de> for RectRange<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<T> Unpin for RectRange<T> where
T: Unpin,
T: Unpin,
impl<T> Send for RectRange<T> where
T: Send,
T: Send,
impl<T> Sync for RectRange<T> where
T: Sync,
T: Sync,
impl<T> RefUnwindSafe for RectRange<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> UnwindSafe for RectRange<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,