pub struct HStack<C> { /* private fields */ }Expand description
A view that arranges its children in a horizontal line.
Use an HStack to arrange views side-by-side. The stack sizes itself to fit
its contents, distributing available space among its children.
ⓘ
hstack((
text("Hello"),
text("World"),
))You can customize the spacing between children and their vertical alignment:
ⓘ
HStack::new(VerticalAlignment::Top, 20.0, (
text("First"),
text("Second"),
))Use [spacer()] to push content to the sides:
ⓘ
hstack((
text("Leading"),
spacer(),
text("Trailing"),
))Implementations§
Trait Implementations§
Source§impl<V> FromIterator<V> for HStack<(Vec<AnyView>,)>where
V: View,
impl<V> FromIterator<V> for HStack<(Vec<AnyView>,)>where
V: View,
Source§fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl<C> Freeze for HStack<C>where
C: Freeze,
impl<C> RefUnwindSafe for HStack<C>where
C: RefUnwindSafe,
impl<C> Send for HStack<C>where
C: Send,
impl<C> Sync for HStack<C>where
C: Sync,
impl<C> Unpin for HStack<C>where
C: Unpin,
impl<C> UnwindSafe for HStack<C>where
C: UnwindSafe,
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