#[repr(u8)]pub enum Corner {
LowerLeft = 0,
LowerRight = 1,
UpperLeft = 2,
UpperRight = 3,
}
Expand description
An enumeration of the corners of an axis-aligned rectangle.
See the module-level documentation for examples.
Variants§
LowerLeft = 0
The lower-left corner.
LowerRight = 1
The lower-right corner.
UpperLeft = 2
The upper-left corner.
UpperRight = 3
The upper-right corner.
Implementations§
source§impl Corner
impl Corner
sourcepub const fn iter() -> CornerIndexableIter ⓘ
pub const fn iter() -> CornerIndexableIter ⓘ
Returns an iterator over all items of Corner
sourcepub const fn count() -> usize
pub const fn count() -> usize
Returns the number of items that will be returned by CornerIndexableIter
that are not disabled members of Corner
source§impl Corner
impl Corner
sourcepub fn side(&self, dir: Dir) -> Side
pub fn side(&self, dir: Dir) -> Side
Gets the Side
corresponding to the given Dir
for this corner.
§Example
assert_eq!(Corner::LowerLeft.side(Dir::Horiz), Side::Left);
assert_eq!(Corner::LowerLeft.side(Dir::Vert), Side::Bot);
assert_eq!(Corner::LowerRight.side(Dir::Horiz), Side::Right);
assert_eq!(Corner::LowerRight.side(Dir::Vert), Side::Bot);
assert_eq!(Corner::UpperLeft.side(Dir::Horiz), Side::Left);
assert_eq!(Corner::UpperLeft.side(Dir::Vert), Side::Top);
assert_eq!(Corner::UpperRight.side(Dir::Horiz), Side::Right);
assert_eq!(Corner::UpperRight.side(Dir::Vert), Side::Top);
Trait Implementations§
source§impl<'de> Deserialize<'de> for Corner
impl<'de> Deserialize<'de> for Corner
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Indexable for Corner
impl Indexable for Corner
source§const SET_SIZE: usize = 1usize
const SET_SIZE: usize = 1usize
The number of bytes it will take to represent this type in a set. Read more
§type Iter = CornerIndexableIter
type Iter = CornerIndexableIter
The type of Iterator that will be returned by [
Self::iter()
]source§impl PartialEq for Corner
impl PartialEq for Corner
source§impl ReverseIndexable for Corner
impl ReverseIndexable for Corner
source§fn from_index(u: usize) -> Self
fn from_index(u: usize) -> Self
Converts from a usize to
Self
impl Copy for Corner
impl Eq for Corner
impl StructuralPartialEq for Corner
Auto Trait Implementations§
impl RefUnwindSafe for Corner
impl Send for Corner
impl Sync for Corner
impl Unpin for Corner
impl UnwindSafe for Corner
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