Struct gardiz::set::Set [−][src]
pub struct Set<T> where
T: Ord, { /* fields omitted */ }
Expand description
The set of coordinates/vectors in a plane, optimized for being in the plane.
Members of the set are Vec2<T>
.
Implementations
Returns the length of the set, i.e. how many Vec2
are stored in this
set.
Tests if the set contains a given point.
pub fn neighbours<U>(
&self,
point: Vec2<&U>,
direction: Direction
) -> Neighbours<'_, T>ⓘNotable traits for Neighbours<'set, T>impl<'set, T> Iterator for Neighbours<'set, T> where
T: Ord, type Item = Vec2<&'set T>;
where
T: Borrow<U>,
U: Ord,
pub fn neighbours<U>(
&self,
point: Vec2<&U>,
direction: Direction
) -> Neighbours<'_, T>ⓘNotable traits for Neighbours<'set, T>impl<'set, T> Iterator for Neighbours<'set, T> where
T: Ord, type Item = Vec2<&'set T>;
where
T: Borrow<U>,
U: Ord,
impl<'set, T> Iterator for Neighbours<'set, T> where
T: Ord, type Item = Vec2<&'set T>;
Returns an iterator to the neighbours of a given point in a straight line in the given direction. The starting point is NOT included.
pub fn neighbours_incl<U>(
&self,
point: Vec2<&U>,
direction: Direction
) -> Neighbours<'_, T>ⓘNotable traits for Neighbours<'set, T>impl<'set, T> Iterator for Neighbours<'set, T> where
T: Ord, type Item = Vec2<&'set T>;
where
T: Borrow<U>,
U: Ord,
pub fn neighbours_incl<U>(
&self,
point: Vec2<&U>,
direction: Direction
) -> Neighbours<'_, T>ⓘNotable traits for Neighbours<'set, T>impl<'set, T> Iterator for Neighbours<'set, T> where
T: Ord, type Item = Vec2<&'set T>;
where
T: Borrow<U>,
U: Ord,
impl<'set, T> Iterator for Neighbours<'set, T> where
T: Ord, type Item = Vec2<&'set T>;
Returns an iterator to the neighbours of a given point in a straight line in the given direction. The starting point IS included.
Returns the nearest neighbour in a straight line of a given point in the the given direction.
Returns the furthest neighbour in a straight line of a given point in the given direction.
Inserts the given point in the set. Returns whether the insertion actually happened (i.e. the point was not already in the set).
Removes a point from the set. Returns whether the removal actuall happened (i.e. the point was in the set).
Returns an iterator over all the points in the set, in the direction of
rows (first point is the lowest), i.e. all X
are yielded before going
to the next Y
.
Returns an iterator over all the points in the set, in the direction of
columns (first point is the lowest), i.e. all Y
are yielded before
going to the next X
.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Set<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Set<T> where
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.