Struct aoc_grid::GridOffset

source ·
pub struct GridOffset<Pos, const DIMS: usize>where
    Pos: GridPos<DIMS>,{ /* private fields */ }

Implementations§

source§

impl<Pos, const DIMS: usize> GridOffset<Pos, DIMS>where Pos: GridPos<DIMS>,

source

pub fn new(size: Pos, pos: Pos) -> NumResult<Self>

source

pub const fn val(&self) -> Pos

source

pub const fn idx(&self) -> isize

Trait Implementations§

source§

impl<Pos, const DIMS: usize> Clone for GridOffset<Pos, DIMS>where Pos: GridPos<DIMS> + Clone,

source§

fn clone(&self) -> GridOffset<Pos, DIMS>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Pos, const DIMS: usize> Debug for GridOffset<Pos, DIMS>where Pos: GridPos<DIMS> + Debug,

source§

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

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

impl<Pos, const DIMS: usize> Default for GridOffset<Pos, DIMS>where Pos: GridPos<DIMS> + Default,

source§

fn default() -> GridOffset<Pos, DIMS>

Returns the “default value” for a type. Read more
source§

impl<Pos, const DIMS: usize> Neg for GridOffset<Pos, DIMS>where Pos: GridPos<DIMS>, Pos::Coord: Neg<Output = Pos::Coord>,

§

type Output = GridOffset<Pos, DIMS>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<Pos, const DIMS: usize> TryAdd<GridOffset<Pos, DIMS>> for GridCursor<Pos, DIMS>where Pos: GridPos<DIMS>,

§

type Output = GridCursor<Pos, DIMS>

source§

fn try_add(self, offset: GridOffset<Pos, DIMS>) -> NumResult<Self>

source§

impl<Pos, const DIMS: usize> TryAddAssign<GridOffset<Pos, DIMS>> for GridCursor<Pos, DIMS>where Pos: GridPos<DIMS>,

source§

fn try_add_assign(&mut self, offset: GridOffset<Pos, DIMS>) -> NumResult<()>

source§

impl<Pos, const DIMS: usize> Copy for GridOffset<Pos, DIMS>where Pos: GridPos<DIMS> + Copy,

Auto Trait Implementations§

§

impl<Pos, const DIMS: usize> RefUnwindSafe for GridOffset<Pos, DIMS>where Pos: RefUnwindSafe,

§

impl<Pos, const DIMS: usize> Send for GridOffset<Pos, DIMS>where Pos: Send,

§

impl<Pos, const DIMS: usize> Sync for GridOffset<Pos, DIMS>where Pos: Sync,

§

impl<Pos, const DIMS: usize> Unpin for GridOffset<Pos, DIMS>where Pos: Unpin,

§

impl<Pos, const DIMS: usize> UnwindSafe for GridOffset<Pos, DIMS>where Pos: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<From, To> QuickInto<To> for Fromwhere To: QuickFrom<From>,

source§

fn quick_into(self) -> To

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.