pub enum Position {
Stacked(Box<PositionSides>),
Absolute(Box<PositionSides>),
Global(Box<PositionSides>),
}Expand description
How an element is placed relative to its parent or the window.
Build one of the variants and set the sides you need with the chainable
top, right, bottom and
left methods:
let stacked = Position::new_stacked(); // default, follows normal layout flow
let absolute = Position::new_absolute().top(10.0).left(20.0); // offset from the parent
let global = Position::new_global().bottom(0.0).right(0.0); // offset from the windowVariants§
Stacked(Box<PositionSides>)
Placed by the normal layout flow alongside its siblings. This is the default.
Absolute(Box<PositionSides>)
Taken out of the flow and positioned by offsets relative to its parent.
Global(Box<PositionSides>)
Taken out of the flow and positioned by offsets relative to the window.
Implementations§
Source§impl Position
impl Position
Sourcepub fn new_absolute() -> Self
pub fn new_absolute() -> Self
Create an Absolute position, offset relative to the parent.
Sourcepub fn new_global() -> Self
pub fn new_global() -> Self
Create a Global position, offset relative to the window.
Sourcepub fn new_stacked() -> Self
pub fn new_stacked() -> Self
Create a Stacked position that follows the normal layout flow.
pub fn is_stacked(&self) -> bool
pub fn is_absolute(&self) -> bool
pub fn is_global(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Position
impl<'de> Deserialize<'de> for Position
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 StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more