Enum style::properties::StyleStructRef
[−]
[src]
pub enum StyleStructRef<'a, T: 'static> {
Borrowed(&'a BuilderArc<T>),
Owned(UniqueArc<T>),
Vacated,
}A reference to a style struct of the parent, or our own style struct.
Variants
Borrowed(&'a BuilderArc<T>)A borrowed struct from the parent, for example, for inheriting style.
Owned(UniqueArc<T>)An owned struct, that we've already mutated.
VacatedTemporarily vacated, will panic if accessed
Methods
impl<'a, T: 'a> StyleStructRef<'a, T> where
T: Clone, [src]
T: Clone,
ⓘImportant traits for &'a mut Wpub fn mutate(&mut self) -> &mut T[src]
ⓘImportant traits for &'a mut W
Ensure a mutable reference of this value exists, either cloning the borrowed value, or returning the owned one.
pub fn take(&mut self) -> UniqueArc<T>[src]
Extract a unique Arc from this struct, vacating it.
The vacated state is a transient one, please put the Arc back
when done via put(). This function is to be used to separate
the struct being mutated from the computed context
pub fn put(&mut self, arc: UniqueArc<T>)[src]
Replace vacated ref with an arc
pub fn get_if_mutated(&mut self) -> Option<&mut T>[src]
Get a mutable reference to the owned struct, or None if the struct
hasn't been mutated.
pub fn build(self) -> Arc<T>[src]
Returns an Arc to the internal struct, constructing one if
appropriate.