pub enum Rotation {
North,
East,
South,
West,
}
Expand description
Represents the four different possibilities of rotation.
Variants§
North
A rotation of 0° (ie. no rotation). This is the default value.
North
+---------+
| ^ |
| |
| |
+---------+
0°
East
A rotation of 90° clockwise.
East
+---------+
| |
| >|
| |
+---------+
90°
South
A rotation of 180°.
South
+---------+
| |
| |
| v |
+---------+
180°
West
A rotation of 270° clockwise.
West
+---------+
| |
|< |
| |
+---------+
270°
Implementations§
Source§impl Rotation
impl Rotation
Sourcepub fn aspect_ratio_changes(&self, rect: &Rect) -> bool
pub fn aspect_ratio_changes(&self, rect: &Rect) -> bool
Returns whether the aspect ratio of the provided Rect changes with the given rotation.
Sourcepub fn next_anchor(&self, rect: &Rect) -> (i32, i32)
pub fn next_anchor(&self, rect: &Rect) -> (i32, i32)
Returns the (x, y) coordinate of the point which will be the Rect’s anchor after it is rotated.
§Explanation
The anchor point of a Rect
is usually the top-left (x,y).
When a Rect
is rotated inside a layout, then another corner
of the Rect
will become the new anchor point after the rotation.
This method returns the current position of that corner.
Sourcepub fn counter_clockwise(&self) -> Self
pub fn counter_clockwise(&self) -> Self
Get the next rotation variant when rotating counter clockwise
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rotation
impl<'de> Deserialize<'de> for Rotation
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
impl Copy for Rotation
impl Eq for Rotation
impl StructuralPartialEq for Rotation
Auto Trait Implementations§
impl Freeze for Rotation
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnwindSafe for Rotation
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