pub struct Property<T> { /* private fields */ }Expand description
One named property of a Model: storage, and the key path that names it.
Cloning shares the storage, so two handles to "count" are two views of one
property.
Implementations§
Source§impl<T: Clone> Property<T>
impl<T: Clone> Property<T>
Sourcepub fn get(&self) -> T
pub fn get(&self) -> T
Read the value, telling the registrar that it was read.
The access half of what an @Observable property’s getter does. Inside
a track block — or inside SwiftUI’s own tracking, which is how a view
body works — this is what subscribes the reader to the next change of this
property: a body that read only this one is not re-run when another
changes, because the registrar recorded this key path and no other.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Property<T>
impl<T> RefUnwindSafe for Property<T>
impl<T> Send for Property<T>
impl<T> Sync for Property<T>
impl<T> Unpin for Property<T>
impl<T> UnsafeUnpin for Property<T>
impl<T> UnwindSafe for Property<T>
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