Struct prototty::Size
[−]
[src]
pub struct Size { /* fields omitted */ }
Used to describe the size of a prototty view, and of a prototty context, in cells.
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]
fn new(x: u32, y: u32) -> Self
[src]
Creates a new Size
.
Panics if x
or y
is greater than ::std::i32::MAX as u32 + 1
.
fn x(&self) -> u32
[src]
Returns the width.
fn y(&self) -> u32
[src]
Returns the height.
fn coords(&self) -> CoordIter
[src]
Returns an iterator over all the coordinates within a rectangle of this size.
fn index(&self, coord: Coord) -> Option<usize>
[src]
Suppose an array is used to implement a 2D grid of this size, where traversing the array from start to end is equivalent to traversing the 2D grid top to bottom, traversing left to right within each row. If a given coordinate is valid for such a grid, this function returns the index into the array corresponding to that coordinate.
fn count(&self) -> usize
[src]
Return the number of cells in a 2D grid of this size.
Trait Implementations
impl Debug for Size
[src]
impl Clone for Size
[src]
fn clone(&self) -> Size
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Size
[src]
impl Hash for Size
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Size
[src]
fn eq(&self, __arg_0: &Size) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Size) -> bool
[src]
This method tests for !=
.
impl Eq for Size
[src]
impl Default for Size
[src]
impl<T: Into<[u32; 2]>> From<T> for Size
[src]
impl<T: Into<Size>> Add<T> for Size
[src]
type Output = Size
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Self::Output
[src]
Performs the +
operation.
impl Add<Coord> for Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, rhs: Coord) -> Self::Output
[src]
Performs the +
operation.
impl<T: Into<Size>> Sub<T> for Size
[src]
type Output = Size
The resulting type after applying the -
operator.
fn sub(self, rhs: T) -> Self::Output
[src]
Performs the -
operation.