[−][src]Struct semeion::space::Dimension
The dimension of a rectangular grid as the integer number of columns and rows.
Fields
x: i32
y: i32
Implementations
impl Dimension
[src]
pub fn with_eq_rectangles(count: usize) -> Self
[src]
Constructs new dimension where the overall rectangle is composed by the
lowest number of rectangles of equal size lower than the given count
,
so that they should be aligned in such a manner that the number of rows
and number of columns are equal (with the last row possibly not being
completely filled).
pub fn len(self) -> usize
[src]
Gets the number of tiles in a grid of given Dimension, equal to the number of row by the number of columns.
pub fn is_empty(self) -> bool
[src]
Returns true only if the number of tiles in the grid is 0.
pub fn is_square(self) -> bool
[src]
Returns true only if the components of this Dimension are equal in magnitude,
that is, self.x == self.y
, and therefore this Dimension represents a square.
pub fn center(self) -> Location
[src]
Gets the Location of the center of this Dimension.
pub fn contains(self, location: impl Into<Location>) -> bool
[src]
Returns true only if the given Location is within this Dimension.
pub fn aspect_ratio(self) -> f32
[src]
Gets the aspect ratio of this Dimension.
pub fn scale(self, other: impl Into<Self>) -> Self
[src]
Maps self with the given Dimension, and returns the number of rows and columns (as new Dimension) that each tile of the given Dimension would have to occupy so that all its tiles would fill up self.
Trait Implementations
impl Clone for Dimension
[src]
impl Copy for Dimension
[src]
impl Debug for Dimension
[src]
impl Default for Dimension
[src]
impl Eq for Dimension
[src]
impl From<(i32, i32)> for Dimension
[src]
impl From<Dimension> for (i32, i32)
[src]
impl Hash for Dimension
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Dimension
[src]
pub fn cmp(&self, other: &Dimension) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Dimension> for Dimension
[src]
impl PartialOrd<Dimension> for Dimension
[src]
pub fn partial_cmp(&self, other: &Dimension) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Dimension) -> bool
[src]
pub fn le(&self, other: &Dimension) -> bool
[src]
pub fn gt(&self, other: &Dimension) -> bool
[src]
pub fn ge(&self, other: &Dimension) -> bool
[src]
impl StructuralEq for Dimension
[src]
impl StructuralPartialEq for Dimension
[src]
Auto Trait Implementations
impl RefUnwindSafe for Dimension
impl Send for Dimension
impl Sync for Dimension
impl Unpin for Dimension
impl UnwindSafe for Dimension
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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 = Infallible
The type returned in the event of a conversion error.
pub 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>,