pub struct ICoord {
pub x: i32,
pub y: i32,
}Expand description
General purpose icoordinate
Fields§
§x: i32§y: i32Implementations§
Source§impl ICoord
impl ICoord
pub const fn new(x: i32, y: i32) -> ICoord
pub const fn from_ucoord(ucoord: UCoord) -> ICoord
pub fn to_ucoord(self) -> UCoord
pub const fn normalize(self, ucoord: UCoord) -> ICoord
pub const fn is_valid(self, ucoord: UCoord) -> bool
pub const fn constrain(self, ucoord: UCoord) -> Option<ICoord>
pub const fn get(self, axis: Axis) -> i32
pub fn get_mut(&mut self, axis: Axis) -> &mut i32
pub fn with_axis<F>(self, axis: Axis, f: F) -> ICoord
pub const fn set(self, axis: Axis, value: i32) -> ICoord
pub fn set_in_place(&mut self, axis: Axis, value: i32)
pub const fn new_axis(this_axis: i32, other_axis: i32, axis: Axis) -> ICoord
pub fn get_static<A>(self) -> i32where
A: StaticAxis,
pub fn get_static_mut<A>(&mut self) -> &mut i32where
A: StaticAxis,
pub fn with_static_axis<A, F>(self, f: F) -> ICoord
pub fn set_static<A>(self, value: i32) -> ICoordwhere
A: StaticAxis,
pub fn set_static_in_place<A>(&mut self, value: i32)where
A: StaticAxis,
pub fn new_static_axis<A>(this_axis: i32, other_axis: i32) -> ICoordwhere
A: StaticAxis,
pub const fn set_x(self, x: i32) -> ICoord
pub const fn set_y(self, y: i32) -> ICoord
pub fn set_x_in_place(&mut self, x: i32)
pub fn set_y_in_place(&mut self, y: i32)
pub fn checked_add(self, rhs: ICoord) -> Option<ICoord>
pub fn checked_sub(self, rhs: ICoord) -> Option<ICoord>
pub fn checked_mul(self, rhs: i32) -> Option<ICoord>
pub fn checked_div(self, rhs: i32) -> Option<ICoord>
pub const fn magnitude2(self) -> u32
pub const fn distance2(self, other: ICoord) -> u32
pub const fn manhattan_magnitude(self) -> u32
pub const fn manhattan_distance(self, other: ICoord) -> u32
pub const fn opposite(self) -> ICoord
pub const fn left90(self) -> ICoord
pub const fn right90(self) -> ICoord
pub const fn cardinal_left45(self) -> ICoord
pub const fn cardinal_right45(self) -> ICoord
pub const fn cardinal_left135(self) -> ICoord
pub const fn cardinal_right135(self) -> ICoord
pub const fn is_zero(self) -> bool
pub fn pairwise_max(self, other: ICoord) -> ICoord
pub fn pairwise_min(self, other: ICoord) -> ICoord
pub const fn transpose(self) -> ICoord
Trait Implementations§
Source§impl<T> AddAssign<T> for ICoord
impl<T> AddAssign<T> for ICoord
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moreSource§impl<T> DivAssign<T> for ICoord
impl<T> DivAssign<T> for ICoord
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moreSource§impl<T> MulAssign<T> for ICoord
impl<T> MulAssign<T> for ICoord
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read moreSource§impl Ord for ICoord
impl Ord for ICoord
Source§impl PartialOrd for ICoord
impl PartialOrd for ICoord
Source§impl<T> SubAssign<T> for ICoord
impl<T> SubAssign<T> for ICoord
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-= operation. Read moreimpl Copy for ICoord
impl Eq for ICoord
impl StructuralPartialEq for ICoord
Auto Trait Implementations§
impl Freeze for ICoord
impl RefUnwindSafe for ICoord
impl Send for ICoord
impl Sync for ICoord
impl Unpin for ICoord
impl UnwindSafe for ICoord
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