pub enum LineSegmentOrPoint {
LineSegment(LineSegment),
Point(Coord),
}Expand description
The LineSegment type can’t represent line segments of 0 length. It’s often convenient for
users to treat 0-length line segments as points. This type represent line segments which can be
of 0 length, treating such lines as single points.
Variants§
LineSegment(LineSegment)
Point(Coord)
Implementations§
Source§impl LineSegmentOrPoint
impl LineSegmentOrPoint
pub fn new(start: Coord, end: Coord) -> Self
pub fn start(&self) -> Coord
pub fn end(&self) -> Coord
pub fn delta(&self) -> Coord
pub fn num_steps(&self) -> u32
pub fn num_cardinal_steps(&self) -> u32
pub fn reverse(&self) -> Self
Sourcepub fn iter(&self) -> LineSegmentOrPointIter
pub fn iter(&self) -> LineSegmentOrPointIter
Iterator over all coordinates allowing ordinal steps which begins on the start coordinate and ends with the end coordinate (inclusively)
Sourcepub fn cardinal_iter(&self) -> LineSegmentOrPointCardinalIter
pub fn cardinal_iter(&self) -> LineSegmentOrPointCardinalIter
Iterator over all coordinates allowing only cardinal steps which begins on the start coordinate and ends with the end coordinate (inclusively)
Auto Trait Implementations§
impl Freeze for LineSegmentOrPoint
impl RefUnwindSafe for LineSegmentOrPoint
impl Send for LineSegmentOrPoint
impl Sync for LineSegmentOrPoint
impl Unpin for LineSegmentOrPoint
impl UnwindSafe for LineSegmentOrPoint
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more