pub struct Property<'a, T, P, I: 'a + Init<T, P>> { /* private fields */ }Expand description
Identifies a property that is present on objects of the appropriate Subject.
§Property Lifetime
The lifetime of a reference to a property on an object is limited by both the object and the property itself. This allows memory to be reclaimed/reused for properties that have been dropped.
ⓘ
use dynprops::{Subject, Dynamic};
let subject = Subject::new();
let prop = subject.new_prop_const_init(5);
let mut obj = Dynamic::new(&subject);
let x = &mut obj[&prop];
drop(prop);
*x = 10; // ERROR: This reference requires prop to be aliveImplementations§
Source§impl<'a, T, P, I: Init<T, P> + Sync> Property<'a, T, P, I>
impl<'a, T, P, I: Init<T, P> + Sync> Property<'a, T, P, I>
Sourcepub fn into_dyn_init(self) -> DynInitProperty<'a, T, P>
pub fn into_dyn_init(self) -> DynInitProperty<'a, T, P>
Converts this property into a DynInitProperty by wrapping its initializer in a
DynInit. Note that this will add overhead if it is already a DynInitProperty.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, P, I> Freeze for Property<'a, T, P, I>where
I: Freeze,
impl<'a, T, P, I> RefUnwindSafe for Property<'a, T, P, I>where
I: RefUnwindSafe,
impl<'a, T, P, I> Send for Property<'a, T, P, I>where
I: Send,
impl<'a, T, P, I> Sync for Property<'a, T, P, I>where
I: Sync,
impl<'a, T, P, I> Unpin for Property<'a, T, P, I>where
I: Unpin,
impl<'a, T, P, I> UnwindSafe for Property<'a, T, P, I>where
I: 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