advent_of_code_2024::day_18

Trait CoordinateExtensions

source
trait CoordinateExtensions: Sized {
    // Required methods
    fn manhattan_distance(&self, other: &Self) -> u32;
    fn step(&self, delta: (i8, i8), bounds: &(u8, u8)) -> Option<Self>;
}

Required Methods§

source

fn manhattan_distance(&self, other: &Self) -> u32

source

fn step(&self, delta: (i8, i8), bounds: &(u8, u8)) -> Option<Self>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CoordinateExtensions for (u8, u8)

source§

fn manhattan_distance(&self, other: &Self) -> u32

The distance between two points in memory space using manhattan distance

source§

fn step(&self, delta: (i8, i8), (r_goal, c_goal): &(u8, u8)) -> Option<Self>

The position after applying a given delta, None if not with in the grid. Note that the max for Memory space is inclusive, because it’s defined as the position of the goal

Implementors§