[−][src]Struct coord_2d::Size
A size cannot be created which would contain un-addressable cells.
That is, the maximum size has a width and height of one greater than the maximum i32
.
Methods
impl Size
[src]
pub fn try_new(
width: u32,
height: u32
) -> Result<Self, DimensionTooLargeForSize>
[src]
width: u32,
height: u32
) -> Result<Self, DimensionTooLargeForSize>
pub fn new(width: u32, height: u32) -> Self
[src]
Creates a new Size
.
Panics if width
or width
is greater than ::std::i32::MAX as u32 + 1
.
pub const fn new_u16(width: u16, height: u16) -> Self
[src]
Like new, but const and never panics as it's impossible to construct an invalid size
pub fn from_coord(coord: Coord) -> Result<Self, NegativeDimension>
[src]
pub fn to_coord(self) -> Result<Coord, DimensionTooLargeForCoord>
[src]
pub fn get(self, axis: Axis) -> u32
[src]
pub fn get_mut(&mut self, axis: Axis) -> &mut u32
[src]
pub fn with_axis<F: FnMut(u32) -> u32>(self, axis: Axis, f: F) -> Self
[src]
pub fn try_set(
self,
axis: Axis,
value: u32
) -> Result<Self, DimensionTooLargeForSize>
[src]
self,
axis: Axis,
value: u32
) -> Result<Self, DimensionTooLargeForSize>
pub fn set(self, axis: Axis, value: u32) -> Self
[src]
pub fn try_set_in_place(
&mut self,
axis: Axis,
value: u32
) -> Result<(), DimensionTooLargeForSize>
[src]
&mut self,
axis: Axis,
value: u32
) -> Result<(), DimensionTooLargeForSize>
pub fn set_in_place(&mut self, axis: Axis, value: u32)
[src]
pub fn try_new_axis(
this_axis: u32,
other_axis: u32,
axis: Axis
) -> Result<Self, DimensionTooLargeForSize>
[src]
this_axis: u32,
other_axis: u32,
axis: Axis
) -> Result<Self, DimensionTooLargeForSize>
pub fn new_axis(this_axis: u32, other_axis: u32, axis: Axis) -> Self
[src]
pub fn get_static<A: StaticAxis>(self) -> u32
[src]
pub fn get_static_mut<A: StaticAxis>(&mut self) -> &mut u32
[src]
pub fn with_static_axis<A: StaticAxis, F: FnMut(u32) -> u32>(self, f: F) -> Self
[src]
pub fn try_set_static<A: StaticAxis>(
self,
value: u32
) -> Result<Self, DimensionTooLargeForSize>
[src]
self,
value: u32
) -> Result<Self, DimensionTooLargeForSize>
pub fn try_set_static_in_place<A: StaticAxis>(
&mut self,
value: u32
) -> Result<(), DimensionTooLargeForSize>
[src]
&mut self,
value: u32
) -> Result<(), DimensionTooLargeForSize>
pub fn set_static<A: StaticAxis>(self, value: u32) -> Self
[src]
pub fn set_static_in_place<A: StaticAxis>(&mut self, value: u32)
[src]
pub fn try_new_static_axis<A: StaticAxis>(
this_axis: u32,
other_axis: u32
) -> Result<Self, DimensionTooLargeForSize>
[src]
this_axis: u32,
other_axis: u32
) -> Result<Self, DimensionTooLargeForSize>
pub fn new_static_axis<A: StaticAxis>(this_axis: u32, other_axis: u32) -> Self
[src]
pub fn try_set_width(self, width: u32) -> Result<Self, DimensionTooLargeForSize>
[src]
pub fn try_set_height(
self,
height: u32
) -> Result<Self, DimensionTooLargeForSize>
[src]
self,
height: u32
) -> Result<Self, DimensionTooLargeForSize>
pub fn set_width(self, width: u32) -> Self
[src]
pub fn set_height(self, height: u32) -> Self
[src]
pub fn try_set_width_in_place(
&mut self,
width: u32
) -> Result<(), DimensionTooLargeForSize>
[src]
&mut self,
width: u32
) -> Result<(), DimensionTooLargeForSize>
pub fn try_set_height_in_place(
&mut self,
height: u32
) -> Result<(), DimensionTooLargeForSize>
[src]
&mut self,
height: u32
) -> Result<(), DimensionTooLargeForSize>
pub fn set_width_in_place(&mut self, width: u32)
[src]
pub fn set_height_in_place(&mut self, height: u32)
[src]
pub const fn width(self) -> u32
[src]
Returns the width.
pub const fn x(self) -> u32
[src]
Alias for width
.
pub const fn height(self) -> u32
[src]
Returns the height.
pub const fn y(self) -> u32
[src]
Alias for height
.
pub const fn count(self) -> usize
[src]
Return the number of cells in a 2D grid of this size.
pub fn checked_sub(self, rhs: Self) -> Option<Self>
[src]
pub fn saturating_sub(self, rhs: Self) -> Self
[src]
pub const fn max_field() -> u32
[src]
pub const fn max() -> Self
[src]
Trait Implementations
impl From<(u32, u32)> for Size
[src]
impl From<[u32; 2]> for Size
[src]
impl Clone for Size
[src]
impl Copy for Size
[src]
impl Default for Size
[src]
impl Eq for Size
[src]
impl Ord for Size
[src]
fn cmp(&self, other: &Size) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Size> for Size
[src]
impl PartialOrd<Size> for Size
[src]
fn partial_cmp(&self, other: &Size) -> Option<Ordering>
[src]
fn lt(&self, other: &Size) -> bool
[src]
fn le(&self, other: &Size) -> bool
[src]
fn gt(&self, other: &Size) -> bool
[src]
fn ge(&self, other: &Size) -> bool
[src]
impl Debug for Size
[src]
impl Div<u32> for Size
[src]
type Output = Size
The resulting type after applying the /
operator.
fn div(self, rhs: u32) -> Self::Output
[src]
impl<'a> Div<u32> for &'a Size
[src]
type Output = Size
The resulting type after applying the /
operator.
fn div(self, rhs: u32) -> Self::Output
[src]
impl Sub<Size> for Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> Self::Output
[src]
impl<'a> Sub<Size> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> Self::Output
[src]
impl<'a> Sub<&'a Size> for Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> Self::Output
[src]
impl<'a, 'b> Sub<&'a Size> for &'b Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> Self::Output
[src]
impl Sub<Coord> for Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Sub<Coord> for &'a Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Sub<&'a Coord> for Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl<'a, 'b> Sub<&'a Coord> for &'b Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl Sub<Size> for Size
[src]
type Output = Size
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> Self::Output
[src]
impl<'a> Sub<Size> for &'a Size
[src]
type Output = Size
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> Self::Output
[src]
impl<'a> Sub<&'a Size> for Size
[src]
type Output = Size
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> Self::Output
[src]
impl<'a, 'b> Sub<&'a Size> for &'b Size
[src]
type Output = Size
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> Self::Output
[src]
impl Add<Size> for Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: Size) -> Self::Output
[src]
impl<'a> Add<Size> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: Size) -> Self::Output
[src]
impl<'a> Add<&'a Size> for Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> Self::Output
[src]
impl<'a, 'b> Add<&'a Size> for &'b Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> Self::Output
[src]
impl Add<Coord> for Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Add<Coord> for &'a Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Add<&'a Coord> for Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl<'a, 'b> Add<&'a Coord> for &'b Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl Add<Size> for Size
[src]
type Output = Size
The resulting type after applying the +
operator.
fn add(self, size: Size) -> Self::Output
[src]
impl<'a> Add<Size> for &'a Size
[src]
type Output = Size
The resulting type after applying the +
operator.
fn add(self, size: Size) -> Self::Output
[src]
impl<'a> Add<&'a Size> for Size
[src]
type Output = Size
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> Self::Output
[src]
impl<'a, 'b> Add<&'a Size> for &'b Size
[src]
type Output = Size
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> Self::Output
[src]
impl Mul<u32> for Size
[src]
type Output = Size
The resulting type after applying the *
operator.
fn mul(self, rhs: u32) -> Self::Output
[src]
impl<'a> Mul<u32> for &'a Size
[src]
type Output = Size
The resulting type after applying the *
operator.
fn mul(self, rhs: u32) -> Self::Output
[src]
impl<T> MulAssign<T> for Size where
Size: Mul<T, Output = Size>,
[src]
Size: Mul<T, Output = Size>,
fn mul_assign(&mut self, rhs: T)
[src]
impl<T> DivAssign<T> for Size where
Size: Div<T, Output = Size>,
[src]
Size: Div<T, Output = Size>,
fn div_assign(&mut self, rhs: T)
[src]
impl Hash for Size
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl StructuralPartialEq for Size
[src]
impl StructuralEq for Size
[src]
Auto Trait Implementations
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnwindSafe for Size
impl RefUnwindSafe for Size
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,