Struct cacao::layout::LayoutConstraint
source · [−]pub struct LayoutConstraint {
pub constraint: ShareId<Object>,
pub offset: f64,
pub multiplier: f64,
pub priority: f64,
pub animator: LayoutConstraintAnimatorProxy,
}
Expand description
A wrapper for NSLayoutConstraint
. This both acts as a central path through which to activate
constraints, as well as a wrapper for layout constraints that are not axis bound (e.g, width or
height).
Fields
constraint: ShareId<Object>
A shared pointer to the underlying view. Provided your view isn’t dropped, this will always be valid.
offset: f64
The offset used in computing this constraint.
multiplier: f64
The multiplier used in computing this constraint.
priority: f64
The priority used in computing this constraint.
animator: LayoutConstraintAnimatorProxy
An animator proxy that can be used inside animation contexts.
Implementations
sourceimpl LayoutConstraint
impl LayoutConstraint
sourcepub fn set_offset<F: Into<f64>>(&self, offset: F)
pub fn set_offset<F: Into<f64>>(&self, offset: F)
Sets the offset of a borrowed constraint.
sourcepub fn set_active(&self, active: bool)
pub fn set_active(&self, active: bool)
Set whether this constraint is active or not. If you’re doing this across a batch of
constraints, it’s often more performant to batch-deactivate with
LayoutConstraint::deactivate()
.
sourcepub fn activate(constraints: &[LayoutConstraint])
pub fn activate(constraints: &[LayoutConstraint])
Call this with your batch of constraints to activate them.
pub fn deactivate(constraints: &[LayoutConstraint])
Trait Implementations
sourceimpl Clone for LayoutConstraint
impl Clone for LayoutConstraint
sourcefn clone(&self) -> LayoutConstraint
fn clone(&self) -> LayoutConstraint
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for LayoutConstraint
impl Send for LayoutConstraint
impl Sync for LayoutConstraint
impl Unpin for LayoutConstraint
impl UnwindSafe for LayoutConstraint
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more