pub enum Position {
Relative,
Absolute,
}
Expand description
The positioning strategy for this item.
This controls both how the origin is determined for the Style::position
field,
and whether or not the item will be controlled by flexbox’s layout algorithm.
WARNING: this enum follows the behavior of CSS’s position
property,
which can be unintuitive.
Position::Relative
is the default value, in contrast to the default behavior in CSS.
Variants§
Relative
The offset is computed relative to the final position given by the layout algorithm. Offsets do not affect the position of any other items; they are effectively a correction factor applied at the end.
Absolute
The offset is computed relative to this item’s closest positioned ancestor, if any. Otherwise, it is placed relative to the origin. No space is created for the item in the page layout, and its size will not be altered.
WARNING: to opt-out of layouting entirely, you must use Display::None
instead on your Style
object.
Trait Implementations§
§impl<'de> Deserialize<'de> for Position
impl<'de> Deserialize<'de> for Position
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Position, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Position, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for Position
impl Serialize for Position
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for Position
impl Eq for Position
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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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