Skip to content
Hatch

Hatch

Mojo struct 🡭

Hatch

@memory_only
struct Hatch

Which pattern hatch_tile renders.

DIAGONAL is one family of parallel lines at 45 degrees, top-left to bottom-right. CROSS adds the perpendicular 45-degree family, crossing the first. DOTS places a single dot at the tile’s center. HORIZONTAL and VERTICAL are one axis-aligned line through the tile’s center.

Aliases

  • DIAGONAL = Hatch(Int(0))
  • CROSS = Hatch(Int(1))
  • DOTS = Hatch(Int(2))
  • HORIZONTAL = Hatch(Int(3))
  • VERTICAL = Hatch(Int(4))

Implemented traits

AnyType, Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, Writable

Methods

__init__

fn def __init__(out self, value: Int)

Prefer the DIAGONAL/CROSS/DOTS/HORIZONTAL/VERTICAL comptime constants over constructing one directly.

Args:

  • value (Int): 0 for DIAGONAL, 1 for CROSS, 2 for DOTS, 3 for HORIZONTAL, 4 for VERTICAL.
  • self (Self)

Returns:

Self

__eq__

fn def __eq__(self, other: Self) -> Bool

Args:

  • self (Self)
  • other (Self)

Returns:

Bool

write_to

fn def write_to[W: Writer](self, mut writer: W)

Parameters:

  • W (Writer)

Args:

  • self (Self)
  • writer (W)

__str__

fn def __str__(self) -> String

Args:

  • self (Self)

Returns:

String