pub struct Positioned {
pub id: Option<NodeId>,
pub left: Option<f32>,
pub top: Option<f32>,
pub right: Option<f32>,
pub bottom: Option<f32>,
pub width: Option<f32>,
pub height: Option<f32>,
pub child: Option<Box<Node>>,
}Expand description
Absolutely positions a child within a ZStack.
Specify one or more edge offsets (left, top, right, bottom) and
optional explicit width/height. Omitting both horizontal offsets (or
both vertical offsets) leaves the child unconstrained on that axis.
§Example
ⓘ
// Pin a badge to the top-right corner
Positioned {
top: Some(8.0),
right: Some(8.0),
child: Some(Box::new(badge_widget)),
..Default::default()
}Fields§
§id: Option<NodeId>Explicit node identity.
left: Option<f32>Distance from the left edge of the parent.
top: Option<f32>Distance from the top edge of the parent.
right: Option<f32>Distance from the right edge of the parent.
bottom: Option<f32>Distance from the bottom edge of the parent.
width: Option<f32>Explicit width override.
height: Option<f32>Explicit height override.
child: Option<Box<Node>>The child widget to position.
Implementations§
Trait Implementations§
Source§impl Clone for Positioned
impl Clone for Positioned
Source§fn clone(&self) -> Positioned
fn clone(&self) -> Positioned
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Positioned
impl Debug for Positioned
Source§impl Default for Positioned
impl Default for Positioned
Source§fn default() -> Positioned
fn default() -> Positioned
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Positioned
impl<'de> Deserialize<'de> for Positioned
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 From<Positioned> for Node
impl From<Positioned> for Node
Source§fn from(w: Positioned) -> Self
fn from(w: Positioned) -> Self
Converts to this type from the input type.
Source§impl Lower for Positioned
impl Lower for Positioned
Source§fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
Lower this widget into the IR, returning the root node id.
Source§impl Serialize for Positioned
impl Serialize for Positioned
Auto Trait Implementations§
impl Freeze for Positioned
impl !RefUnwindSafe for Positioned
impl Send for Positioned
impl Sync for Positioned
impl Unpin for Positioned
impl UnsafeUnpin for Positioned
impl !UnwindSafe for Positioned
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.