Layout

Struct Layout 

Source
pub struct Layout {
    pub vars: LayoutVars,
    pub name: Option<String>,
    pub id: LayoutId,
    pub hidden: bool,
    /* private fields */
}
Expand description

Represents a single item in the overall layout hierarchy with a bounding rectangle and an id.

Modifying any properties of this layout only stores those changes here, they won’t affect the solver until this struct is passed to the solver.

Fields§

§vars: LayoutVars§name: Option<String>§id: LayoutId§hidden: bool

Implementations§

Source§

impl Layout

Source

pub fn new(id: LayoutId, name: Option<String>) -> Self

Creates a new Layout.

Source

pub fn layout(&mut self) -> &mut Self

Source

pub fn no_container(&mut self)

Clears the container of the current Layout.

Source

pub fn set_container<T>(&mut self, container: T)
where T: LayoutContainer + 'static,

Replaces the container of the current layout. The container is what determines what constraints will be added between this layout and it’s children, as they are added, if any.

Source

pub fn edit_left(&mut self) -> VariableEditable<'_>

Source

pub fn edit_top(&mut self) -> VariableEditable<'_>

Source

pub fn edit_right(&mut self) -> VariableEditable<'_>

Source

pub fn edit_bottom(&mut self) -> VariableEditable<'_>

Source

pub fn edit_width(&mut self) -> VariableEditable<'_>

Source

pub fn edit_height(&mut self) -> VariableEditable<'_>

Source

pub fn create_constraint<B: ConstraintBuilder>( &self, builder: B, ) -> Vec<Constraint>

Source

pub fn add<B: ConstraintBuilder>(&mut self, builder: B)

Source

pub fn remove_constraint(&mut self, constraint: Constraint)

Source

pub fn remove_constraints(&mut self, constraints: Vec<Constraint>)

Source

pub fn has_constraint(&mut self, constraints: &Vec<Constraint>) -> bool

Source

pub fn get_constraints(&mut self) -> HashSet<Constraint>

Source

pub fn get_removed_constraints(&mut self) -> Vec<Constraint>

Source

pub fn get_edit_vars(&mut self) -> Vec<EditVariable>

Source

pub fn add_child(&mut self, child: &mut Layout)

Source

pub fn remove_child(&mut self, child: &mut Layout)

Source

pub fn get_removed_children(&mut self) -> Vec<LayoutId>

Source

pub fn get_children(&self) -> &Vec<LayoutId>

Source

pub fn add_associated_vars(&mut self, vars: &LayoutVars, name: &str)

Source

pub fn add_associated_var(&mut self, var: Variable, name: &str)

Source

pub fn get_associated_vars(&mut self) -> Vec<(Variable, String)>

Source

pub fn hide(&mut self)

Source

pub fn show(&mut self)

Trait Implementations§

Auto Trait Implementations§

§

impl Freeze for Layout

§

impl !RefUnwindSafe for Layout

§

impl !Send for Layout

§

impl !Sync for Layout

§

impl Unpin for Layout

§

impl !UnwindSafe for Layout

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.