pub struct ComposedBuilder { /* private fields */ }Expand description
Collects the properties a composed view will have.
See ComposedView.
Implementations§
Source§impl ComposedBuilder
impl ComposedBuilder
pub fn new() -> Self
Sourcepub fn state<T: StateValue>(&mut self, initial: T) -> StateProp<T>
pub fn state<T: StateValue>(&mut self, initial: T) -> StateProp<T>
Add a @State var: T, starting at initial.
T is one of StateValue: bool, i64, f64 or String.
Sourcepub fn app_storage<T: StoredValue>(
&mut self,
key: &str,
default: T,
) -> StoredProp<T>
pub fn app_storage<T: StoredValue>( &mut self, key: &str, default: T, ) -> StoredProp<T>
Add an @AppStorage(key) var: T.
Sourcepub fn focus_state(&mut self) -> FocusProp
pub fn focus_state(&mut self) -> FocusProp
Add a @FocusState var: Bool.
Attach it to a field with crate::views::focused_on; then
Props::focus reports whether that field has focus and
ComposedView::set_focus moves it.
Sourcepub fn environment<K: EnvKey>(&mut self) -> EnvProp<K>
pub fn environment<K: EnvKey>(&mut self) -> EnvProp<K>
Add an @Environment(\.…) var.
Sourcepub fn build(
self,
body: impl Fn(&Props) -> ViewHandle + Send + 'static,
) -> ComposedView
pub fn build( self, body: impl Fn(&Props) -> ViewHandle + Send + 'static, ) -> ComposedView
Synthesise the type and one instance, with body as its body.
Trait Implementations§
Auto Trait Implementations§
impl !Send for ComposedBuilder
impl !Sync for ComposedBuilder
impl Freeze for ComposedBuilder
impl RefUnwindSafe for ComposedBuilder
impl Unpin for ComposedBuilder
impl UnsafeUnpin for ComposedBuilder
impl UnwindSafe for ComposedBuilder
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