UCoord

Struct UCoord 

Source
pub struct UCoord(/* private fields */);

Implementations§

Source§

impl UCoord

Source

pub fn new(width: u32, height: u32) -> UCoord

Creates a new UCoord. Panics if width or height is greater than ::core::i32::MAX.

Source

pub const fn new_u16(width: u16, height: u16) -> UCoord

Like new, but const and never panics as it’s impossible to construct an invalid ucoord

Source

pub fn from_icoord(icoord: ICoord) -> UCoord

Source

pub const fn to_icoord(self) -> ICoord

Source

pub const fn get(self, axis: Axis) -> u32

Source

pub fn with_axis<F>(self, axis: Axis, f: F) -> UCoord
where F: FnMut(u32) -> u32,

Source

pub fn set(self, axis: Axis, value: u32) -> UCoord

Source

pub fn set_in_place(&mut self, axis: Axis, value: u32)

Source

pub fn new_axis(this_axis: u32, other_axis: u32, axis: Axis) -> UCoord

Source

pub fn get_static<A>(self) -> u32
where A: StaticAxis,

Source

pub fn with_static_axis<A, F>(self, f: F) -> UCoord
where A: StaticAxis, F: FnMut(u32) -> u32,

Source

pub fn set_static<A>(self, value: u32) -> UCoord
where A: StaticAxis,

Source

pub fn set_static_in_place<A>(&mut self, value: u32)
where A: StaticAxis,

Source

pub fn new_static_axis<A>(this_axis: u32, other_axis: u32) -> UCoord
where A: StaticAxis,

Source

pub fn set_width(self, width: u32) -> UCoord

Source

pub fn set_height(self, height: u32) -> UCoord

Source

pub fn set_width_in_place(&mut self, width: u32)

Source

pub fn set_height_in_place(&mut self, height: u32)

Source

pub const fn width(self) -> u32

Returns the width.

Source

pub const fn height(self) -> u32

Returns the height.

Source

pub const fn count(self) -> usize

Return the number of cells in a 2D grid of this size.

Source

pub fn checked_sub(self, rhs: UCoord) -> Option<UCoord>

Source

pub fn saturating_sub(self, rhs: UCoord) -> UCoord

Source

pub const fn max_field() -> u32

Source

pub const fn max() -> UCoord

Source

pub const fn is_zero(self) -> bool

Source

pub const fn is_valid(self, icoord: ICoord) -> bool

Source

pub const fn constrain(self, icoord: ICoord) -> Option<ICoord>

Source

pub const fn icoord_iter_row_major(self) -> ICoordIterRowMajor

Source

pub fn pairwise_max(self, other: UCoord) -> UCoord

Source

pub fn pairwise_min(self, other: UCoord) -> UCoord

Source

pub const fn transpose(self) -> UCoord

Source

pub const fn is_empty(self) -> bool

Source

pub const fn is_on_edge(self, _: ICoord) -> bool

Source

pub fn edge_iter(self) -> Iter

Trait Implementations§

Source§

impl<'a, 'b> Add<&'a ICoord> for &'b UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: &'a ICoord) -> <&'b UCoord as Add<&'a ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<&'a ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: &'a ICoord) -> <UCoord as Add<&'a ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a, 'b> Add<&'a UCoord> for &'b ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: &'a UCoord) -> <&'b ICoord as Add<&'a UCoord>>::Output

Performs the + operation. Read more
Source§

impl<'a, 'b> Add<&'a UCoord> for &'b UCoord

Source§

type Output = UCoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: &'a UCoord) -> <&'b UCoord as Add<&'a UCoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<&'a UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: &'a UCoord) -> <ICoord as Add<&'a UCoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<&'a UCoord> for UCoord

Source§

type Output = UCoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: &'a UCoord) -> <UCoord as Add<&'a UCoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<ICoord> for &'a UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: ICoord) -> <&'a UCoord as Add<ICoord>>::Output

Performs the + operation. Read more
Source§

impl Add<ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: ICoord) -> <UCoord as Add<ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<UCoord> for &'a ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: UCoord) -> <&'a ICoord as Add<UCoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<UCoord> for &'a UCoord

Source§

type Output = UCoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: UCoord) -> <&'a UCoord as Add<UCoord>>::Output

Performs the + operation. Read more
Source§

impl Add<UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: UCoord) -> <ICoord as Add<UCoord>>::Output

Performs the + operation. Read more
Source§

impl Add for UCoord

Source§

type Output = UCoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: UCoord) -> <UCoord as Add>::Output

Performs the + operation. Read more
Source§

impl Clone for UCoord

Source§

fn clone(&self) -> UCoord

Returns a duplicate 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 Debug for UCoord

Source§

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

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

impl Default for UCoord

Source§

fn default() -> UCoord

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

impl<'a> Div<u32> for &'a UCoord

Source§

type Output = UCoord

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u32) -> <&'a UCoord as Div<u32>>::Output

Performs the / operation. Read more
Source§

impl Div<u32> for UCoord

Source§

type Output = UCoord

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u32) -> <UCoord as Div<u32>>::Output

Performs the / operation. Read more
Source§

impl<T> DivAssign<T> for UCoord
where UCoord: Div<T, Output = UCoord>,

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl From<[u32; 2]> for UCoord

Source§

fn from(array: [u32; 2]) -> UCoord

Converts to this type from the input type.
Source§

impl From<(u32, u32)> for UCoord

Source§

fn from(_: (u32, u32)) -> UCoord

Converts to this type from the input type.
Source§

impl Hash for UCoord

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> Mul<u32> for &'a UCoord

Source§

type Output = UCoord

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> <&'a UCoord as Mul<u32>>::Output

Performs the * operation. Read more
Source§

impl Mul<u32> for UCoord

Source§

type Output = UCoord

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> <UCoord as Mul<u32>>::Output

Performs the * operation. Read more
Source§

impl<T> MulAssign<T> for UCoord
where UCoord: Mul<T, Output = UCoord>,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl Ord for UCoord

Source§

fn cmp(&self, other: &UCoord) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for UCoord

Source§

fn eq(&self, other: &UCoord) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for UCoord

Source§

fn partial_cmp(&self, other: &UCoord) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, 'b> Sub<&'a ICoord> for &'b UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: &'a ICoord) -> <&'b UCoord as Sub<&'a ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: &'a ICoord) -> <UCoord as Sub<&'a ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a, 'b> Sub<&'a UCoord> for &'b ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: &'a UCoord) -> <&'b ICoord as Sub<&'a UCoord>>::Output

Performs the - operation. Read more
Source§

impl<'a, 'b> Sub<&'a UCoord> for &'b UCoord

Source§

type Output = UCoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: &'a UCoord) -> <&'b UCoord as Sub<&'a UCoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: &'a UCoord) -> <ICoord as Sub<&'a UCoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a UCoord> for UCoord

Source§

type Output = UCoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: &'a UCoord) -> <UCoord as Sub<&'a UCoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<ICoord> for &'a UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: ICoord) -> <&'a UCoord as Sub<ICoord>>::Output

Performs the - operation. Read more
Source§

impl Sub<ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: ICoord) -> <UCoord as Sub<ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<UCoord> for &'a ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: UCoord) -> <&'a ICoord as Sub<UCoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<UCoord> for &'a UCoord

Source§

type Output = UCoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: UCoord) -> <&'a UCoord as Sub<UCoord>>::Output

Performs the - operation. Read more
Source§

impl Sub<UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: UCoord) -> <ICoord as Sub<UCoord>>::Output

Performs the - operation. Read more
Source§

impl Sub for UCoord

Source§

type Output = UCoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: UCoord) -> <UCoord as Sub>::Output

Performs the - operation. Read more
Source§

impl Copy for UCoord

Source§

impl Eq for UCoord

Source§

impl StructuralPartialEq for UCoord

Auto Trait Implementations§

§

impl Freeze for UCoord

§

impl RefUnwindSafe for UCoord

§

impl Send for UCoord

§

impl Sync for UCoord

§

impl Unpin for UCoord

§

impl UnwindSafe for UCoord

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 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.