Skip to main content

Line

Struct Line 

Source
pub struct Line {
    pub at: Pos,
    pub len: u16,
    pub orientation: Orientation,
    pub stroke: Stroke,
}
Expand description

A line: a position, a length, an orientation and a stroke. It names no glyph of its own — an end is one arm in the line’s stroke, not a chosen glyph, because an end has to say where the stroke stops and what may join it there, which an arm does and a literal cannot: a literal composes as a cell with four Closed arms, so nothing connects into it and two lines meeting at a shared end could never make the corner they make.

A complete shape in the sense of Complete and fragment in docs/model.md. No minimum length is declared: a length of 0 draws nothing, a length of 1 draws its one position as an end, and neither is rejected.

Fields§

§at: Pos

The position of the line’s first cell.

§len: u16

How many cells the line occupies. Any value is accepted, including 0.

§orientation: Orientation

Whether the line runs along a row or a column.

§stroke: Stroke

The stroke every cell this line writes is drawn in.

Trait Implementations§

Source§

impl Debug for Line

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Shape for Line

Source§

fn draw(&self, surface: &mut dyn Surface)

Draws this shape’s cells into surface.

Auto Trait Implementations§

§

impl Forget for Line

§

impl Freeze for Line

§

impl RefUnwindSafe for Line

§

impl Send for Line

§

impl Sync for Line

§

impl Unpin for Line

§

impl UnsafeUnpin for Line

§

impl UnwindSafe for Line

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.